1 #!/usr/bin/python 2 3 # Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved. 4 # 5 # run in icu/ 6 # will create file icu/as_is/bomlist.txt 7 # 8 # Usage: 9 # ( python as_is/bomlist.py > as_is/bomlist.txt ) || rm -f as_is/bomlist.txt 10 11 import os 12 import codecs 13 14 tree = os.walk(".") 15 16 nots=0 17 notutf8=0 18 noprops=0 19 utf8=0 20 fixed=0 21 tfiles=0 22 bom=codecs.BOM_UTF8 23 24 25 for ent in tree: 26 (path,dirs,files) = ent 27 if(path.find("/.svn") != -1): 28 continue 29 for file in files: 30 tfiles=tfiles+1 31 fp = (path + "/" + file) 32 if not os.path.isfile(fp): 33 continue 34 f = open(fp, 'rb') 35 bytes=f.read(3) 36 if bytes and (bytes == bom): 37 print 'icu/'+fp[2::] 38 f.close() 39