One of the most annoying things for me is having stray files lying around in my uploads folders for a variety of reasons – mostly because I mess around with stuff too much. At present, WordPress doesn’t provide a tool to find these stray files or any means of figuring out which ones you’re using (or not).
So I wrote TIEmediahelper.
This WordPress plugin does only one job at the moment – it searches through your wp-uploads folder (and sub-folders) to find stray files which are on disk but not listed in the WP Media Library.
For each file it finds, it creates an “unattached” entry in the Media Library, with the appropriate file type and meta data (if any).
The plugin works in real time, so if it gets interrupted there’s no danger of duplicates – just re-run the process and it’ll find the files it didn’t get around to when it was stopped.
You can download or install the plugin from the WordPress Plugin Repository. You can, of course, donate to the development fund:
The plugin currently has three limitations.
Firstly, duplicate files in different folders may not be found if one of them is already listed. So if you have an image called “picture.png” in two different folders and one of them is already in the Media Library, you may not see a new entry for the unlisted one.
This is because of the vast amount of stupidly complex image metadata WP generates – it just wasn’t worth trawling through it all for a few missed dupes, in my opinion. Maybe one day, if enough people need that much precision!
Secondly, media files will not be associated with their posts. Since they’re floating files, there’s no way for the plugin to know which ones belonged to which posts, if any.
Thirdly, the plugin is very process-intensive. On sites with a lot of uploads (and on wussy servers), it may time out. You’ll get the standard “Maximum execution time of 30 seconds exceeded” error message.
Don’t worry: since the plugin operates in real time, you can just hit “back” on your browser and kick it off again. It’ll skim through all the files it found (that bit’s a lot quicker than creating new items, obviously) then carry on adding from where it left off.
TIEmediahelper is not included in TIEtools at the moment.
Bugs and requests
These are all handled through the WordPress Plugin repository and the associated forums.
There are currently no known bugs beyond the limitations outlined above.