I want to copy all my JPG files in one directory to a new directory. How can I solve this in Python?I just start to learn Python.
Thanks for your reply.
I want to copy all my JPG files in one directory to a new directory. How can I solve this in Python?I just start to learn Python.
Thanks for your reply.
Just use the following code
import shutil, os
files = ['file1.txt', 'file2.txt', 'file3.txt']
for f in files:
shutil.copy(f, 'dest_folder')
N.B.: You're in the current directory. If You have a different directory, then add the path in the files list. i.e:
files = ['/home/bucket/file1.txt', '/etc/bucket/file2.txt', '/var/bucket/file3.txt']