Copy multiple files in Python
You can use os.listdir() to get the files in the source directory, os.path.isfile() to see if they are regular files (including symbolic links on *nix systems), and shutil.copy to do the copying.
The following code copies only the regular files from the source directory into the destination directory (I'm assuming you don't want any sub-directories copied).
import osimport shutilsrc_files = os.listdir(src)for file_name in src_files: full_file_name = os.path.join(src, file_name) if os.path.isfile(full_file_name): shutil.copy(full_file_name, dest)
Look at shutil in the Python docs, specifically the copytree command.
If the destination directory already exists, try:
shutil.copytree(source, destination, dirs_exist_ok=True)