hello folk ...
i am trying to write a code to get all .exe files from a dir by using os.walk .. then i need it to move this files to another location ...
this is my code :
thank u brothers i did it :
i am trying to write a code to get all .exe files from a dir by using os.walk .. then i need it to move this files to another location ...
this is my code :
import os import shutil for root, dirs, files in os.walk("/home/evilcode1/Desktop/My Files/USB/test/"): for file in files: if file.endswith(".exe"): print(os.path.join(root, file)) print( "start copy ... " )can u help me how to move this files to another location
thank u brothers i did it :
import os import shutil source = "/home/evilcode1/Desktop/My Files/USB/test/" dist = "/home/evilcode1/Desktop/py" for root, dirs, files in os.walk(source): for file in files: if file.endswith(".exe"): q = os.path.join(root, file) print q + " ------> copy done" shutil.copy2(q , dist) print( "Finish" )