import os
import time
import subprocess
def TimeStampToTime(timestamp):
timeStruct = time.localtime(timestamp)
return time.strftime('%Y-%m-%d_%H-%M-%S',timeStruct)
curPath = os.getcwd()
subprocess.getoutput("cd %s"%curPath)
filelist = os.listdir(curPath)
for i in range(0,len(filelist)):
suffix = os.path.splitext(filelist[i])[1]
ctimestamp = os.path.getctime(filelist[i])
cTime = TimeStampToTime(ctimestamp)
NewName = cTime + suffix
print(subprocess.getoutput("pwd"))
print(subprocess.getoutput("mv "+filelist[i] +" " + NewName))
#os.rename(curPath+'/'+filelist[i],curPath+'/'+NewName)