blob: 412647294fb1e3c9155545a4fb325879f8de3315 [file] [log] [blame]
Geoff Lang0e435462013-09-03 15:21:51 -04001import fnmatch
2import os
3import sys
4
5rootdirs = [ ]
6filetypes = [ ]
7
8foundTypesArg = False
9for i in range(1, len(sys.argv)):
10 arg = sys.argv[i]
11 if arg == "-types":
12 foundTypesArg = True
13 continue
14
15 if foundTypesArg:
16 filetypes.append(arg)
17 else:
18 rootdirs.append(arg)
19
20for rootdir in rootdirs:
21 for root, dirnames, filenames in os.walk(rootdir):
22 for file in filenames:
23 for type in filetypes:
24 if fnmatch.fnmatchcase(file, type):
25 print os.path.join(root, file).replace("\\", "/")
26 break