Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python glob all files in directory recursively

import os, fnmatch


def find_files(directory, pattern):
    for root, dirs, files in os.walk(directory):
        for basename in files:
            if fnmatch.fnmatch(basename, pattern):
                filename = os.path.join(root, basename)
                yield filename


for filename in find_files('src', '*.c'):
    print 'Found C source:', filename
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #glob #files #directory #recursively
ADD COMMENT
Topic
Name
7+2 =