Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Simply had a lot of files I needed to rename
- import os
- # Get the current directory
- path = os.getcwd()
- # Gather all file names
- filenames = os.listdir(path)
- # Loop through change all file endings from .htm to .xhtml.
- # changing to lowercase for readability, personal preference
- for filename in filenames:
- os.rename(filename, filename.replace(".htm",".xhtml").lower())
Add Comment
Please, Sign In to add comment