Python遍历清理VC项目中的Debug Release ipch 及 sdf

VC编译后生成的Debug、Release、ipch目录及sdf文件占用大量空间,不方便代码保存,写了个Python程序自动遍历清理。

import osimport shutildef remove_vc_extra(root_dir):    list_dirs = os.walk(root_dir, topdown=False)    for dirpath, dirnames, filenames in list_dirs:        for dirname in dirnames:            if dirname == 'Debug' or dirname == 'Release' or dirname == 'ipch':                shutil.rmtree(os.path.join(dirpath, dirname), ignore_errors=True)        for filename in filenames:            path, ext = os.path.splitext(filename)            if ext == '.sdf':                os.remove(os.path.join(dirpath, filename))if __name__ == '__main__':    root_dir = input('根目录:')    remove_vc_extra(root_dir)
Python遍历清理VC项目中的Debug Release ipch 及 sdf

相关文章:

你感兴趣的文章:

标签云: