Skip to content

Instantly share code, notes, and snippets.

@srustagi
Created June 16, 2020 22:27
Show Gist options
  • Save srustagi/b10a6a9e2f3ddb6363f951415bc73442 to your computer and use it in GitHub Desktop.
Save srustagi/b10a6a9e2f3ddb6363f951415bc73442 to your computer and use it in GitHub Desktop.
Remove UTC timestamp from Windows File History Backup for all files in folder recursively, skip over duplicates.
import re
from os.path import join
from os import walk, rename
FOLDER_PATH = join('shivr-hdd')
for path, subdirs, files in walk(FOLDER_PATH):
for i, name in enumerate(files):
fixed = re.sub(r' \(.+\)\.', '.', name)
print('{} / {}'.format(i + 1, len(files)))
try:
rename(join(path, name), join(path, fixed))
except FileExistsError:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment