ファイルのコピーや移動、削除

ファイルのコピーや移動、削除

コピー(更新日など属性ごと)


import shutil

shutil.copy2(srcpath, destpath)

移動


import shutil

shutil.move(srcpath, destpath)

削除


import os

os.remove(file)

ディレクトリの一括削除


import shutil

shutil.rmtree(os.path.join(resetpath, 'FullMatch'), ignore_errors=True)

タイトルとURLをコピーしました