Skip to content

Commit 7cf7c06

Browse files
committed
merge_folders
1 parent dce0dda commit 7cf7c06

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

xklb/scripts/merge_folders.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ def print_mv(t):
100100
printing.pipe_print("mv", t[1], t[2])
101101

102102
def mv(t):
103+
mv_fn = os.renames
103104
if t[0]: ## file exists in destination already
105+
mv_fn = os.replace
104106
if not clobber:
105107
log.info("[%s]: Skipping due to existing file %s", t[1], t[2])
106-
else:
107-
os.replace(t[1], t[2])
108-
else: ## file does not exist in destination already
109-
try:
110-
os.renames(t[1], t[2])
111-
except Exception:
112-
file_utils.rename_move_file(t[1], t[2])
108+
return
109+
try:
110+
mv_fn(t[1], t[2])
111+
except Exception:
112+
file_utils.rename_move_file(t[1], t[2])
113113

114114
if args.simulate:
115115
for p in empty_folder_data:

0 commit comments

Comments
 (0)