Skip to content

Instantly share code, notes, and snippets.

@vik-y
Created December 31, 2014 17:52
Show Gist options
  • Save vik-y/e0afca85f4df7f33f012 to your computer and use it in GitHub Desktop.
Save vik-y/e0afca85f4df7f33f012 to your computer and use it in GitHub Desktop.
Change extension of all files in a given folder
import os, sys
files = os.listdir(os.getcwd())
for f in files:
x = f.split('.')
r = x[0] + '.extension' #The extension which you want to give to the file
os.renames(f, r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment