批量改文件名

下载了一批视频文件居然都是乱码,播放器还无法播放,一个个改名字太复杂啦

发现这样的场景还是挺多的,搞个PY脚本吧

import os

print "***batch change file name ***"

 

for files in os.walk(os.getcwd()):

    for file_list in files:

        i = 1

        for file_name in file_list:

            if '.avi' in file_name:

                os.system('rename ' + file_name + ' ' + str(i) + '.avi')

                i += 1

Submit a comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>
quote
</blockquote>
example: http://google.com