Plugin or method to delete uploads not in media library?

Over time working on a local and development server I’ve accumulated some junk in my wp-content/uploads folder which are not in the database. The folder and database entry are fairly large and so I was wondering if there was a plugin or way to do some type of “garbage collection” and delete items in the uploads folder which are not in the media library.

Related posts

Leave a Reply

1 comment

  1. There is no easy way to do this. You could query the WP database for wp_posts that are media uploads and then run a script to match those again the files in the uploads folder, but even this would be a little shaky.