0

In Drupal 7 (I also have the Media module installed), there is a functionality in /admin/content/file

Home » Administration » Content » Content

that lists all files being uploaded. If you click on a single file's "Usage" link, you can see exactly how many times that file has been used in the whole site, I would like to order that table by the column "Usage" to see files that haven't been used and then delete them.

Unfortunately it's not possible to order that column. Is there another way to achieve this? Is Views Bulk Operations the best available option?

  • If you want to only to view used file you could use simply Views, or not? – arrubiu Feb 6 '14 at 7:21
  • Please, @arrubiu, post your answer so that I can vote it. – Mau Feb 7 '14 at 3:58
  • @arrubiu i was hoping to get around unused files collecting dust on the main server, that's all, any direction? – Mau Feb 25 '14 at 11:24
1

It maybe isn't exactly what you are after but I found the answer at Find orphaned unused files and images to be most helpful. Particularly the comment by @Marcos Buarque mentioning comment 7427898 which mentions a nice query to tidy up using the file_delete() function built into D7

  • i see. where is the best way to put that PHP code? shall i just run it from a node with PHP code enabled? – Mau Sep 1 '14 at 4:46
  • I was thinking a view could be the easiest way. Any ideas? – Mau Sep 2 '14 at 3:16
  • @mauro I personally created a small module to do this with a hook_menu function to give it a URL. I also got it to print the URI of the file out so I could check it had actually been deleted. Is that something you would need help with or are you comfortable creating modules? – cferthorney Sep 3 '14 at 11:20
  • i wasn't thinking to create a module, just a view. i am interested in seeing the module you created. please let me know. – Mau Sep 4 '14 at 0:42
0

The latest dev version of the file_entity module use a view that shows how many places the file is used in. Instead of a "Usage" column, it say's "Used in." You can see this in action if you try https://www.drupal.org/project/media_dev -2.x-dev on simplytest.me

Hope that helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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