RECURRENT DONATION
Donate monthly to support
the NeculaiFantanaru.com project
您可以在此处查看完整代码:HTTPS://帕萨特斌.com/和NA一ww2Q import shutil import os def move_files(source_director, destination_director): # select the files in the source directory fisiere = [fisier for fisier in os.listdir(source_director) if os.path.isfile(os.path.join(source_director, fisier))] print(fisiere) # each file in the source directory is moved to the destination directory for fisier in fisiere: shutil.move(source_director + '\\' + fisier, destination_director) def copy_files(source_director, destination_director): # select the files in the source directory fisiere = [fisier for fisier in os.listdir(source_director) if os.path.isfile(os.path.join(source_director, fisier))] print(fisiere) # each file in the source directory is copied to the destination directory for fisier in fisiere: shutil.copy(source_director + '\\' + fisier, destination_director) if __name__ == '__main__': # WARNING: paths to directories must be written with '\\' (double backslash) # here you set the DIN directory you want to move / copy the files source_director = 'c:\\Folder' destination_director = 'c:\\Folder\\Subfolder1\\Subfolder2' #CASE 1 # move_files(source_director, destination_director) #CASE 2 copy_files(source_director, destination_director) That's all folks. If you like my code, then make me a favor: translate your website into Romanian, "ro".
Latest articles accessed by readers:
Donate via Paypal
RECURRENT DONATIONDonate monthly to support SINGLE DONATIONDonate the desired amount to support Donate by Bank TransferAccount Ron: RO34INGB0000999900448439
Open account at ING Bank
|
||||||||||||
![]() |
||||||||||||