1

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?

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

2 Answers 2

2

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

4
  • 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
    Commented Sep 1, 2014 at 4:46
  • I was thinking a view could be the easiest way. Any ideas?
    – Mau
    Commented Sep 2, 2014 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? Commented Sep 3, 2014 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
    Commented Sep 4, 2014 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 and acknowledge you have read our privacy policy.

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