Move images (listed in a file) to an address also in the file


Long story short.

A bad WordPress migration left the wp-content/uploads folder in a total mess.
Grossly overloaded with unnecessary images.

I would like to Move the needed images to a fresh /uploads folder.

So I renamed it uploads_bak

Then I extracted the list of images that are being used for products from the DB.
(Found in _wp_attachment_metadata)




They are currently in wp-content/uploads_bak/

And what I want to do is I want to move them to:


So, the scripts I have found will read the file and move them all to a destination. But I need the destination to be flexible too. /uploads/2019/01/

Anyone able to offer a command that will read the file, amend the destination and Make the dirs needed on the fly, as you do!

Note: I am looking at leaving any redundant images behind in uploads_bak so renaming it is not a solution.

Dynamodaveo 2 months 0 Answers 6 views 0

Leave an answer