Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have massive number of files in my uploads folder. Is there a way of identifying those which are not linked to any post?

Note: some of those files are manually copied to uploads folder not via "media library"

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

The easiest way would probably be:

1) perform a WordPress XML export ( Dashboard -> Tools -> Export )

2) import into a clean WordPress install ( Dashboard -> Tools -> Import )

At this point, everything in the /uploads directory of the clean install is attached. You can now:

3) backup/delete your original /uploads directory

4) copy over the /uploads directory from the clean install

share|improve this answer
    
Would it be possible to automatically import all manually copied files (as if they were imported via media library)? So I can use built-in feature to detect unlinked files? –  user3047 Apr 19 '11 at 20:04
    
I don't understand your question. –  Chip Bennett Apr 19 '11 at 20:08
    
ok. At the moment half of the media files are imported regularly via medial library. I like that. I can go to dashboard->media->un_attached and manage my media files easily (find unattached files)... but the other half is manually copy/pasted into uploads folder so wordpress can't see them... so I can't use the un_attached option –  user3047 Apr 19 '11 at 20:17
    
This plugin lets you recreate your media library from uploads folder wordpress.org/extend/plugins/add-from-server –  user3047 Apr 19 '11 at 21:25
    
Now I need to get rid of duplicate attachments... hell –  user3047 Apr 19 '11 at 21:49
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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