Created
December 9, 2018 20:24
-
-
Save kerolloz/7e27007901eb6b37c9cb3f993ff1d260 to your computer and use it in GitHub Desktop.
change filenames from .html to .php in current directory
This file contains 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 os | |
def rename_html_to_php(): | |
for filename in os.listdir("."): | |
if os.path.isdir(filename): | |
os.chdir("./"+filename) | |
rename_html_to_php() | |
os.chdir("..") | |
if filename.endswith(".html"): | |
print(filename, "changed !") | |
os.rename(filename, filename.replace(".html", ".php")) | |
if __name__ == "__main__": | |
rename_html_to_php() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment