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/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to