'2017/11'에 해당되는 글 1건

  1. 2017.11.24 Rename
Coding/Python 삽질기2017. 11. 24. 00:28
import os

'''
Start : 2017.11.23
End : 2017.11.23
'''

currdir = os.getcwd()
fileList = []

fileList = os.listdir(currdir)

for filename in fileList:
fullfilename = os.path.join(currdir, filename)

if os.path.isdir(fullfilename):
print "["+fullfilename+ "]"
elif (".gif" in fullfilename) and ("_" not in fullfilename):
newFileName = fullfilename[:-4] + "_1.gif"
os.rename(fullfilename, newFileName)
print fullfilename + " -> " + newFileName


'Coding > Python 삽질기' 카테고리의 다른 글

Python Tip  (0) 2018.04.26
Python으로 만든 File manager  (0) 2017.08.20
[Python] 날짜 시간 출력 하기  (0) 2017.07.08
Posted by chobocho