Skip to content

Instantly share code, notes, and snippets.

@leonardreidy
Created October 28, 2016 16:28
Show Gist options
  • Save leonardreidy/d331d183189913be9068afa1284e4b4b to your computer and use it in GitHub Desktop.
Save leonardreidy/d331d183189913be9068afa1284e4b4b to your computer and use it in GitHub Desktop.
Change all file endings in the current folder to .md if they are currently ending in .txt
import os,sys
folder = os.getcwd();
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', '.md')
output = os.rename(infilename, newname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment