We use WP as a CMS and have maintained a client site for

We use WP as a CMS and have maintained a client site for over a year. The ../wp-content/uploads folder has 2,000 files (over 2GB total), and I'm guessing 80% of them are obsolete (no longer referenced by published or private pages). I would like to clean up this directory. Is there a way to easily (or relatively easily) identify orphan files?

  • mikebaronps
    • Flash Drive

    Hi Jack,

    Thanks for the suggestions. Unfortunately the plugins mentioned in your link look pretty buggy and this is a production site that I can't take that risk with.

    I need to read up about what happens under the covers when you upload a file to the Media Library. I did an XML export from a production site to a dev copy, then copied the contents of the dev uploads folder (via remote FTP) and the Media files count did not increment.

    Then (separately) I went back into Production and filtered by Unattached (Media files; I have about 500 of them), deleted one, then discovered that the image was deleted from the site as well. (I re-uploaded and it re-appeared.) I thought unattached meant, well, unattached. Strange.

    So more work to do on my part!

    Thanks again for your quick reply.

  • Wharrf
    • Site Builder, Child of Zeus

    Hi Mike,

    If you are hitting 2GB in space with 500 photos, your photos are probably not optimized for the web.

    I suggest you could try installing http://wordpress.org/plugins/ewww-image-optimizer/ for your clients. You could also use smush.it's plugin, but the service is not stable IMO.

    Also, you can run any images right now though kraken.io with lossy compression and that will reduce your 4mb photos down to like 500kb and probably more.

    You can store more files and reduce the amount of time spent helping your client optimize their site.

    its one of the techniques that we are using at http://www.stewaard.com to help our clients.

  • mikebaronps
    • Flash Drive

    Hi Buooy,

    Thanks for the info. Most of my media files are in fact not images, but rather PDFs and their corresponding source files (.doc, .xls, etc.). Still, there are enough image files to make this worth checking out, as I'm sure they're unoptimized.

    Thanks again.

    Mike

  • Jack Kitterhing
    • Code Norris

    Hi there Mike,

    Hope you're well today and sorry about the delay here.

    Thanks for the additional information, interesting, on that piece of media, it isn't attached as a featured image, correct? In the column within the media library, there should be a attached column and it should say yes or no, please advise :slight_smile:

    Thanks! Sorry again about the delay.

    Kind Regards
    Jack.

  • mikebaronps
    • Flash Drive

    It's not a featured image. I also don't see an Attached column but here's what the Media Assistant page looks like for this file. Does that help? Curious (to me at least) that it says it UNATTACHED, but it also lists the page it's inserted into.

    Thanks.

  • Jack Kitterhing
    • Code Norris

    Hi Mike,

    Thanks for the additional information, very interesting, I can't replicate this on any of my install.

    Can you send me WP admin login information so I could take a closer look at this?

    If that is possible please send to contact(at)wpmudev.org with the subject line Attn: Jack Kitterhing

    Thanks!

    Kind Regards
    Jack.

  • Jack Kitterhing
    • Code Norris

    Hi there @mikebaronps,

    Hope you're well today, I've had a look around and can't find much else here, if the image is added via the media editor, it should be attached (as long as the post is published, which it is).

    I've included my colleague @Alexander Rohmann here to see if he has any ideas here that we could try, thanks for your patience on this :slight_smile:

    Thanks!

    Kind Regards
    Jack.

  • Alexander
    • DEV MAN’s Mascot

    Hi @mikebaronps,

    I'm not sure how that would happen. Would need login and database access to take a closer look.

    Do you have a staging server? If you're dealing with large production environments where it's difficult to make changes, I'd recommend getting a deployment system in place that allows you to setup and teardown staging servers.

    Some (like WPStack) have ways to synch the production DB to the staging environment for more accurate testing.

    Best regards,

  • aristath
    • Recruit

    Hello there!
    As we haven't heard back from you we're going to assume the problem was sorted out and mark this thread as resolved.

    If it wasn't resolved, or you have any more questions related to this thread please feel free to post them below and tick the 'Mark as Not Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and, as always, for being a member of WPMU DEV, it's a pleasure to help you out and we look forward to being of assistance in the future.

    Cheers,
    Ari.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.