copy multiple files in python -
How to copy all the files into a directory in Python I have a source path and destination path in a string.
You can use the files to obtain the source directory, to see if they There are regular files (including symbolic links on * nix system), and to copy.
The following code copies only the destination files from the source directory into the destination directory (I assume that you do not want to copy a sub-directory).
import os importil src_files = file_name for oslistdir (src) src_files: full_file_name = os.path. If join (os.path.isfile (full_file_name)) (src, file_name): shutil.copy (full_file_name, dest)
Comments
Post a Comment