In order to overcome the "The selected file could not be used because the file does not exist in the database" issue when using filefield_sources with imce_filefield as described in many places -

I created a drush command based on the one provided in the last link. It will scan the private, public or any custom path for any unmanaged files (files that do not have a corresponding entry in the file_managed table) and will optionally import those files.

Just place in ~/.drush, issue a "drush cc drush" to clear the drush command cache and you're good to go. See "drush help filescan" for help on the command and its options.

Hope it helps someone, and please do backup your database!

findfiles.drush_.inc_.txt6.33 KBbohemier
Members fund testing for the Drupal project. Drupal Association Learn more


moshe weitzman’s picture

Status: Needs review » Closed (won't fix)

Thats useful but not generally applicable enough for drush core. Try another project or start your own. Thanks.

bohemier’s picture

OK, Thanks Moshe