Function to copy files from one folder to another
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 859
✭✭✭✭
Answers
-
The following can be used:
import os def CopyFiles(dir1, dir2): ''' Copy all files of dir1 directory into dir2 directory ''' try: for filename in os.listdir(dir1): shutil.copy(os.path.join(dir1,filename), dir2) return True except: ExtAPI.Log.WriteMessage("Error : Could not copy files") return None
2