blackswars Posted June 5, 2023 Share Posted June 5, 2023 Hi, I was looking to extract all my product images quickly. So I asked ChatGPT to do a python script for me. All you have to do is to download the "p" folder at "[Your Store]/img/" and run the python script : import os import shutil def copy_img(source, destination): counter = 0 for root, dirs, files in os.walk(source): filename = ''.join(root.split(os.sep)[len(source.split(os.sep)):]) + '.jpg' if filename in files: source_file = os.path.join(root, filename) destination_file = os.path.join(destination, filename) print("Copying file " + filename) shutil.copy(source_file, destination_file) counter += 1 return counter source = input("What is \"p\" folder path ?\n") destination = input("What is the destination path ?\n") files_copied = copy_img(source, destination) print("\nDone ! " + str(files_copied) + " files copied.\n") Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now