Created
November 4, 2018 06:04
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