Used drupal_system_listing instead of file_scan_directoy. I could never get the mask correct for the latter.