vik-y
12/31/2014 - 5:52 PM

Change extension of all files in a given folder

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)