Edit

kc3-lang/angle/samples/enumerate_files.py

Branch :

  • Show log

    Commit

  • Author : Geoff Lang
    Date : 2013-09-03 15:21:51
    Hash : 0e435467
    Message : Refactored the samples.gyp file.

  • samples/enumerate_files.py
  • import fnmatch
    import os
    import sys
    
    rootdirs = [ ]
    filetypes = [ ]
    
    foundTypesArg = False
    for i in range(1, len(sys.argv)):
        arg = sys.argv[i]
        if arg == "-types":
            foundTypesArg = True
            continue
        
        if foundTypesArg:
            filetypes.append(arg)
        else:
            rootdirs.append(arg)
    
    for rootdir in rootdirs:
        for root, dirnames, filenames in os.walk(rootdir):
            for file in filenames:
                for type in filetypes:
                    if fnmatch.fnmatchcase(file, type):
                        print os.path.join(root, file).replace("\\", "/")
                        break