?

Log in

Tue, Oct. 5th, 2010, 01:40 pm
python file rename batch script

there has to be a quicker way of doing this.

python script to mass rewrite files based on the non-case-sensitive search term


>>> import os
>>> from glob import glob
>>> for fname in filelist:
...     flow = fname.lower()
...     fsplit,fext = flow.split('.')
...     fsplit = fsplit.split('-')
...     if fsplit[1] == 'main':
...             os.rename(fname,fsplit[0]+'.orig.'+fext)
...             print fname,'::',fsplit[0]+'.orig.'+fext
... 

Fri, Apr. 8th, 2011 10:52 am (UTC)
donojong: Good

keep posting like this it’s really very good idea, you are awesome!