python代码
# -*- coding: utf-8 -*-
import sys, os.path
'''
遍历指定路径下所有文件夹,删除空文件夹和Thumbs.db文件
'''
def thumbs_del(path):
for root, dirs, files in os.walk(path):
if dirs==[] and files==[]:
os.rmdir(os.path.join(path, root))
else:
for f in files:
if f == "Thumbs.db":
os.remove(os.path.join(root, f))
#print(root+f)
#flist.append(f)
if __name__ == '__main__': # this way the module can be
thumbs_del(sys.argv[1])
#match_file_ren('.', '快捷方式 到 ([^\.]*).exe(.lnk)', ' ')
保存为thumbs_del.py
total commander工具按钮配置为
命令:c:\Python27\python.exe
参数:c:\Python27\Scripts_own\thumbs_del.py %P%N
图标文件:C:\WINDOWS\system32\dpvsetup.exe
ok,用用看看
No comments:
Post a Comment