Need help to delete .bak.jpg images

I had enabled “Store a copy of my full-size images” in the Smush Pro now I’m having facing storage issues because of the .bak.jpg file created.
Is there a way we can bulk delete the backup images?

  • Adam Czajczyk
    • Support Gorilla

    Hello Susan

    I hope you’re well today and thank you for your question!

    The option that you used is there to let you keep backup of original, full-size, not optimized images in case optimization wen’t “too far” and you’d need to restore them easily. But yes, the side-effect is that it does add up a lot to the storage space usage.

    These images, however, are not only image files on the server but also related entries in the database so also those would have to be removed. There’s currently no built-in option in Smush for this but I believe there’s a way to do it with an additional bit of code.

    I’ve already asked our developers for help with this and we’ll update you here soon so please keep an eye on this ticket for further information.

    Best regards,
    Adam

  • Panos
    • SLS

    Hi Susan !

    As Adam mentioned, those files are handy to keep original images as a backup. If you are sure that you don’t need those anymore, you can delete them with the a custom snippet that you can find here :
    https://gist.github.com/wpmudev-sls/e4f1b8ed361e5490816d370817d454d2
    You can download it, unzip and upload file smush-original-images.php to your wp-content/mu-plugins folder.

    At this point I would strongly recommend to first try this on a staging or local site before uploading to your production site.

    Once uploaded you will have a new admin menu under Smush Pro menu in admin, called Original Images. Click on it (should link to site.com/wp-admin/admin.php?page=original-images) and it will load a page which should start listing all those .bak images. Those are loaded with ajax, and if there are a lot, or they are huge, it might take some time.

    Click on the ones you want to delete, or check the Check all checkbox in case you want them all deleted, then click on the Delete Selected button and it should start deleting images. Again it might take a while.

    If you are not that comfortable uploading files via ftp, let us know if you are 100% sure you want those deleted, confirm that you have a recent backup and we can do this for you :slight_smile:

    Kind regards!

  • Dimitris
    • Support Star

    Hello there Susan

    I hope you’re doing well and don’t mind me chip in here!

    I was reviewing the chats you had with Aditya and Ohidul yesterday and noticed that we shared with you that this functionality of deleting .bak files will be added in core Smush as a new option in the upcoming update. I’m afraid that Aditya was confused with another internal post, as this isn’t tasked as a new feature. I’m really sorry for the confusion made here, some points are on your way as a little compensation.

    Thank you,
    Dimitris

  • Susan
    • Stand Out

    Hello again,
    My developer is having difficulties with this custom plugin. He thinks it might be timing out, it never completes. I think it would be better if you guys could do it please. We have a backup and are certain we no longer need these .bak.jpg files. Thank you so very much!
    Susan

  • Panos
    • SLS

    Offcourse! Could you share admin and ftp access for the site you want those .bak files deleted?

    You can send that privately through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:Subject: “Attn: Panos Lyrakis”

    – Admin login:
    Admin username
    Admin password
    Login url

    – FTP credentials
    host
    username
    password
    (and port if required)

    – link back to this thread for reference

    Kind regards!

  • Panos
    • SLS

    Hi Susan !

    I did run the snippet it and I don’t see those .bak files listed anymore. I’m not sure where the script has been uploaded, as I connected with ftp you shared but I don’t see that in the mu-plugins folder. Once you confirm that those files have been removed you can delete the php file with the snippet I shared in a previous post.

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.