# python -V Python 2.7.5 # cd 'target_dir'| ls | xargs python rename.py
rename.py
from datetime import date, datetime, timedelta
import os
import sys
argvs = sys.argv
#print argvs
del argvs[0]
for i in argvs:
#print i
stat = os.stat(i)
last_modified = stat.st_mtime
#print(last_modified)
date_format = datetime.fromtimestamp(last_modified)
date_format -= timedelta(days = 1)
date_string = date_format.strftime('%Y%m%d')
bfr_name = str(i)
aft_name = str(date_string+'.hoge')
print 'mv '+ bfr_name + ' to '+ aft_name
os.rename(bfr_name , aft_name)