use Path.rename to overwrite

This commit is contained in:
z4yx 2020-04-19 17:58:05 +08:00
parent a8b0c783c9
commit 5901d7484c

View File

@ -85,7 +85,8 @@ def move_files_in(src: Path, dst: Path):
for file in src.glob('*'): for file in src.glob('*'):
empty = False empty = False
print(f"moving {file} to {dst}") print(f"moving {file} to {dst}")
shutil.move(str(file), str(dst)) # shutil.move(str(file), str(dst))
file.rename(dst / file.name) # Overwrite files
if empty: if empty:
print(f"{src} is empty") print(f"{src} is empty")