0

We uninstalled the "Feeds" and "Job Scheduler" modules, after a successful imported csv data by Feeds. However, the csv file is still maintained in "media" list. When we try to delete that file, it say "The file xxx.csv is in use and cannot be deleted". Is there a way to delete that, or do we have to delete from FTP?

2
  • Have you run update.php to update the database after removing the module?
    – bitfed
    Apr 24, 2014 at 22:24
  • Ya, we did the update database after removed the module. It still unable to delete.
    – CocoSkin
    Apr 25, 2014 at 12:34

2 Answers 2

2

The "file still in use and cannot be deleted" means Drupal's still managing the file, so don't remove it via FTP because that basically bypasses Drupal and could cause other issues related to Drupal expecting a file to be somewhere and it's suddenly not there. So I'd recommend finding a solution that involves working via the UI and not directly on the file system.

Is the file attached as a field to an item of content somewhere? That would result in "file still in use". If so, delete the item of content, clear cache a few times and check again.

3
  • The only time we used that file was imported by "Feeds" module. And the Feeds module has been uninstalled.
    – CocoSkin
    Apr 24, 2014 at 20:39
  • @H-L uninstalling module does not remove it's usage marks on files. It should probably be used to delete file, if it's the one that uploaded it.
    – Mołot
    Apr 25, 2014 at 6:37
  • It may used when to "delete file" when running "Feeds" module. But I already uninstalled the Feeds. There should be a way to delete that, because that csv data already imported into database.
    – CocoSkin
    Apr 28, 2014 at 16:57
0

Just in case, run the file through file_usage_list() to be absolutely sure it's not used anywhere else. You never know.

If only Feeds comes back as a result, you can then always run the file through file_delete(), though you'll have to use the $force parameter.

2
  • Sorry Vodde, I'm not a developer. But I really want to know how to run "file_usage_list()"
    – CocoSkin
    Apr 25, 2014 at 12:38
  • 1
    The easiest way to do that, would be to install the Devel module. After doing that, you can run PHP by browsing to devel/php, type the required code and press submit. This should pretty much do it: $fid = [file_id]; $file = file_load($fid); dpm(file_usage_list($file)); You'll have to find the file's ID first though, and replace '[file_id]' with that number. Another option is to access your DB and browse in the file_usage table, again using the file's ID and look at the value listed under 'module'
    – Vodde
    Apr 25, 2014 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.