Skip to content

Instantly share code, notes, and snippets.

@pauljacobson
Created November 4, 2018 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauljacobson/3e06a9a124a86a7e58ade2178fb282c2 to your computer and use it in GitHub Desktop.
Save pauljacobson/3e06a9a124a86a7e58ade2178fb282c2 to your computer and use it in GitHub Desktop.
Rename files with Python
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