T
Tiefeng Wu
Hello everybody!
I need make all files extension to lower by a given directory.
Here is my solution:
import os
def make_all_file_ext_lower(root):
for path, subdirs, files in os.walk(root):
for file in files:
(name, ext) = os.path.splitext(file)
fullname = name[:len(name) - 1] + ext.lower()
os.rename(os.path.join(path, file), os.path.join(path, fullname))
I know this code is lame and maybe someone can give a better?
Just for learning, thanks!
wutiefeng
06-11-01
___________________________________________________________
ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ
http://cn.mail.yahoo.com/
I need make all files extension to lower by a given directory.
Here is my solution:
import os
def make_all_file_ext_lower(root):
for path, subdirs, files in os.walk(root):
for file in files:
(name, ext) = os.path.splitext(file)
fullname = name[:len(name) - 1] + ext.lower()
os.rename(os.path.join(path, file), os.path.join(path, fullname))
I know this code is lame and maybe someone can give a better?
Just for learning, thanks!
wutiefeng
06-11-01
___________________________________________________________
ÑÅ»¢Ãâ·ÑÓÊÏä-3.5GÈÝÁ¿£¬20M¸½¼þ
http://cn.mail.yahoo.com/