RosettaCodeData/Task/Walk-a-directory-Recursively/Python/walk-a-directory-recursively-2.py
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

9 lines
247 B
Python

from fnmatch import fnmatch
import os, os.path
def print_fnmatches(pattern, dir, files):
for filename in files:
if fnmatch(filename, pattern):
print os.path.join(dir, filename)
os.path.walk('/', print_fnmatches, '*.mp3')