Created
June 26, 2017 06:54
-
-
Save surgicalmaskman/46d2c9b337ef1f4b1989f64b323ac1b2 to your computer and use it in GitHub Desktop.
replace file name for ISO8601 standard to ISO 8601 extended
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/env python | |
# -*- coding:utf-8 -*- | |
import os | |
files= os.listdir(os.getcwd()) | |
for i in range(len(files)): | |
if files[i].isdigit()== True: | |
print(files[i]) | |
tmp= files[i] | |
yr= tmp[:4] + '-' + tmp[4:] | |
new= yr[:7]+ '-' + yr[7:] | |
os.rename(files[i], new) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment