Skip to content

Instantly share code, notes, and snippets.

@HarshCasper
Created July 27, 2020 09:03
Show Gist options
  • Save HarshCasper/b296d565b073a72e3877f2297f77a567 to your computer and use it in GitHub Desktop.
Save HarshCasper/b296d565b073a72e3877f2297f77a567 to your computer and use it in GitHub Desktop.
import os
folder = r'Project Path'
for filename in os.listdir(folder):
infilename = os.path.join(folder, filename)
if not os.path.isfile(infilename): continue
oldbase = os.path.splitext(filename)
newname = infilename.replace('.txt', '.js')
output = os.rename(infilename, newname)
print("Complete")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment