mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
apt-sync: rm dir after mv all files in it
Otherwise tmp_dir.rmdir() would fail as dirs in it have not been deleted
This commit is contained in:
parent
ef3a5bccac
commit
f0a7704a0e
@ -108,6 +108,7 @@ def move_files_in(src: Path, dst: Path):
|
|||||||
if file.is_dir():
|
if file.is_dir():
|
||||||
(dst / file.name).mkdir(parents=True, exist_ok=True)
|
(dst / file.name).mkdir(parents=True, exist_ok=True)
|
||||||
move_files_in(file, dst / file.name)
|
move_files_in(file, dst / file.name)
|
||||||
|
file.rmdir() # rmdir wont fail as all files in it have been moved
|
||||||
else:
|
else:
|
||||||
file.rename(dst / file.name) # Overwrite files
|
file.rename(dst / file.name) # Overwrite files
|
||||||
if empty:
|
if empty:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user