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've been given the directive to "retire" about 1000 articles from a wordpress site I maintain. Deleting the posts from the DB is trivial, but how would one go about deleting the orphaned files from the uploads folder?

share|improve this question
    
I used php to delete the attachment files inside the folder. –  Ari Susanto Nov 24 '13 at 8:20
add comment

1 Answer 1

up vote 2 down vote accepted

take a look at Upload Janitor plugin. its a plugin i use to clean up unused images and other files from your uploads folder.

but just in case make a backup of your uploads directory first

share|improve this answer
    
That's the one. I knew there was something like that. Thanks! –  Dan Gayle Jan 31 '11 at 19:31
    
Interesting plugin. It seems to be dealing with the backup thing as well - taken from the plugin description: "Before any action is taken, Upload Janitor will automatically make a 'tar' archive of all files to be erased, including their original paths, so you can restore if necessary." –  Michal Mau Jan 31 '11 at 19:59
    
glad i could help :) –  Bainternet Jan 31 '11 at 20:36
    
Any ideas for a suitable replacement to upload janitor for Wordpress 3.0+, given that it doesn't support WP3? –  user16797 Jun 6 '12 at 14:06
1  
@rilwis No. From the looking at the source, it looks like the plugin only considers images included in the body of posts.It doesn't look for post thumbnails ("featured images"), for custom meta values, or for references to images in your stylesheet. Though I'd say that images referenced in your stylesheet are better kept in your theme directory, rather than your uploads dir (I assume that stylesheet references are what you mean when you talk about slider, social icons, etc.). –  MathSmath Jun 6 '12 at 15:12
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.