同意gz_runwe
下面是我用的python脚本,
import os
def remove_file(file_name):
try:
os.remove(file_name)
print '----------delete file:',file_name
except:
pass
for the_dir,sub_dir,file_list in os.walk('.'):
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
print '>>>cd directory:',the_dir
for file_name in file_list:
print 'check file:',file_name
if file_name.find('.~')>0 or file_name.find('.ddp')>0 or \
file_name.find('.bak')>0 or file_name.find('.map')>0:
remove_file(the_dir+os.sep+file_name)
continue
if file_name.find('.obj')>0: #remove when there has source file
if os.path.exists(the_dir+os.sep+file_name.replace('.obj','.cpp')):
remove_file(the_dir+os.sep+file_name)
continue
if file_name.find('.obj')>0: #remove when there has source file
if os.path.exists(the_dir+os.sep+file_name.replace('.obj','.cxx')):
remove_file(the_dir+os.sep+file_name)
continue
if file_name.find('.obj')>0: #remove when there has source file
if os.path.exists(the_dir+os.sep+file_name.replace('.obj','.c')):
remove_file(the_dir+os.sep+file_name)
continue
if file_name.find('.dcu')>0: #remove when there has source file
if os.path.exists(the_dir+os.sep+file_name.replace('.dcu','.pas')):
remove_file(the_dir+os.sep+file_name)
continue