Created
November 4, 2018 06:04
-
-
Save pauljacobson/3e06a9a124a86a7e58ade2178fb282c2 to your computer and use it in GitHub Desktop.
Rename files with Python
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
from pathlib import Path | |
for file in Path(".").glob("*.1"): | |
name, ext, _ = file.name.split(".") # There were no other .'s in the names | |
file.rename(f"{name}.sld{ext}") | |
# From https://dev.to/rpalo/automating-simple-things-with-python-is-awesome-3jlg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment