24 directory = sys.argv[1] |
24 directory = sys.argv[1] |
25 exclude_dirs = [] |
25 exclude_dirs = [] |
26 if(len(sys.argv)>2): |
26 if(len(sys.argv)>2): |
27 x_dirs = string.lower(sys.argv[2]) |
27 x_dirs = string.lower(sys.argv[2]) |
28 exclude_dirs = re.split(',', x_dirs) |
28 exclude_dirs = re.split(',', x_dirs) |
29 scandir(directory, exclude_dirs,directory) |
29 scandir(directory, exclude_dirs) |
30 |
30 |
31 def scandir(top, exclude_dirs,directory): |
31 def scandir(top, exclude_dirs): |
32 fixpath = re.compile('\\\\') |
32 fixpath = re.compile('\\\\') |
33 fixroot = re.compile('^%s\\\\' % top) |
33 fixroot = re.compile('^%s\\\\' % top) |
34 for root, dirs, files in os.walk(top, topdown=True): |
34 for root, dirs, files in os.walk(top, topdown=True): |
35 for dirname in dirs: |
35 for dirname in dirs: |
36 if(string.lower(fixpath.sub('/',os.path.join(root,dirname))) in exclude_dirs): |
36 if(string.lower(fixpath.sub('/',os.path.join(root,dirname))) in exclude_dirs): |
37 dirs.remove(dirname) |
37 dirs.remove(dirname) |
38 for name in files: |
38 for name in files: |
39 filename = os.path.join(root, name) |
39 filename = os.path.join(root, name) |
40 fn = string.lower(fixpath.sub('/',fixroot.sub('',filename))) |
40 fn = string.lower(fixpath.sub('/',fixroot.sub('',filename))) |
41 print fn.strip(directory) |
41 print top+"/"+fn |
42 |
42 |
43 main() |
43 main() |