Python Glob Semua file di direktori secara rekursif
import glob
for f in glob.glob('/path/**/*.c', recursive=True):
print(f)
DreamCoder
import glob
for f in glob.glob('/path/**/*.c', recursive=True):
print(f)
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