Support » Fixing WordPress » Media Library delete files left from backup restoration

  • Resolved Thomas Jarvis

    (@thomasjarvisdesign)


    I have recently had to use WP-Toolkit in Plesk to undo some changes to a site I am developing.

    Context

    I am using WpAllImport to import images in bulk to a woocommerce store.

    Unfortunately I made a mistake and instead of saving one copy. It saved one copy per variation due to a settings error.

    I restored the files and database to just before I ran the import but the upload folder was not overwritten – The files merged meaning my upload folder now contains thousands of files that are no longer in the WordPress media library.

    Is there a way to automatically delete files from the uploads folder that are NOT in the media library?

    The uploads folder with thumbnail generation sits at over 80,000 files and it should only be about 10,000 files.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Automatically delete non-library files that are mixed in with legitimate library files? In theory it’s possible, but it’s an extremely slow, inefficient process. And the algorithm may need to be custom developed. You should first try searching for a plugin the purports to clean up unneeded files from the uploads folders.

    TBH, you’re possibly better off wiping out everything and redoing the import with the right settings. But you said something about merging. These files were imported into an existing site? So you couldn’t wipe out everything, you’d lose all the original files that were not imported along with those that were.

    I don’t suppose you have a back up of the original files you could restore from? Do the imported files have new dates, or were their original dates maintained? It’s possible to delete files newer than a certain date, then redo the import. A no go if the original dates were kept.

    Thread Starter Thomas Jarvis

    (@thomasjarvisdesign)

    I ended up using meow apps media cleaner Pro. The pro version includes a file system scanner. Worked first time but cost 30 dollars.

    problem is now solved. I was asking to see if anyone had any other solutions.

    I asked on the plesk forum as well. They have suggested restoring the backup to a different directory manually and replacing thr media library manually.

    Basically I found a serious oversight in plesks wordpress toolkit backup process. The restor button merges files when it should really replace given how wordpress works. But I can highly recommend meow apps media cleaner Pro. In the first pass it totally solved the problem

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.