又快又脏的python实用程序,主要供我自己使用:
import os
import os.path
location = "C:\PATH\Resources\Stuff.rc"
loca = set([])
used = set([])
for root,dirs,files in os.walk(os.path.dirname(location)):
for item in files:
item = item.lower()
if (item.endswith('.bmp')):
loca.add(os.path.join(root.lower(),item))
with open(location) as rcfile:
for line in rcfile:
for token in line.split('"'):
token = token.lower()
if token.endswith('.bmp'):
used.add(os.path.join(os.path.dirname(location).lower(),token.replace('\\\\','\\')))
print '\n'.join(loca - used)
print len(loca)
print len(used)
print len(loca - used)