24 lines
563 B
Python
Executable file
24 lines
563 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
# Rename sync-conflict files to normal files
|
|
|
|
# WARNING Does not check for conclicts
|
|
|
|
import os
|
|
import re
|
|
|
|
for root, dirs, files in os.walk('.'):
|
|
for f in files:
|
|
if '.sync-conflict' not in f:
|
|
continue
|
|
nf = re.sub('.sync-conflict-\d{8}-\d{6}-\w{7}', '', f)
|
|
F = os.path.join(root, f)
|
|
NF = os.path.join(root, nf)
|
|
if os.path.exists(NF):
|
|
print(f"'{F}' → '{NF}': file already exists")
|
|
else:
|
|
print(f"'{F}' → '{NF}': done")
|
|
os.rename(F, NF)
|
|
|
|
|