python での shutil.copy と shutil.move

Python での shutil.copy と shutil.move の違い

コピー 動く
copy(fileA,fileB) OK
ファイルは存在し、上書きできます...
shutil.move(fileA,fileB) OK
fileB存在 OK
copyfile(fileA,fileB) OK
copy(fileA,folderB) OK は
最終的に folderB を生成します/filexxx ファイルが存在します
shutil.move(fileA,folderB) OK
folderB/filename が存在する場合、エラーが報告されます
copyfile(fileA,folderB) はエラーを報告します。
copytree(folderA, folderB, symlinks=True)
folderB は存在できません
shutil.move(folderA,folderB)
folderB が存在しません OK ie rename
copytree(folderA,folderB) folderB が存在する場合、エラーが報告されます shutil.move(folderA,folderB)
folderB あり OK 即電影folderB/folderA/

おすすめ

転載: blog.csdn.net/coraline1991/article/details/120430652