Created
December 22, 2021 14:51
-
-
Save jckw/c9e66585857dd17e51818666c8da58ac to your computer and use it in GitHub Desktop.
Rename simple files to UUID names. Useful for renaming folders of photos for slideshows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import os | |
import uuid | |
if __name__ == "main": | |
files = os.listdir() | |
for f in files: | |
suffix = pathlib.Path(f).suffix | |
original = f | |
updated = str(uuid.uuid4()) + suffix | |
print(original, "->", updated) | |
os.rename(original, updated) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment