The difference between shutil.copy and shutil.move in python
copy | move |
---|---|
copy(fileA,fileB) OK The file exists and can be overwritten... |
shutil.move(fileA,fileB) OK fileB exists OK |
copyfile(fileA,fileB) OK | |
copy(fileA,folderB) OK will finally generate folderB/filexxx file exists |
shutil.move(fileA,folderB) OK If folderB/filename exists, an error will be reported |
copyfile(fileA,folderB) reports an error. | |
copytree(folderA, folderB, symlinks=True) folderB cannot exist |
shutil.move(folderA,folderB) folderB not exist OK ie rename |
copytree(folderA,folderB) If folderB exists, an error will be reported | shutil.move(folderA,folderB) folderB exist OK 即电影folderB/folderA/ |