diff options
author | Guido van Rossum <guido@python.org> | 1995-01-27 02:41:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-27 02:41:45 (GMT) |
commit | 7e4b2def34f5cb6c954148a7458c8e1aa4584320 (patch) | |
tree | 9b6a93f3726eac8f595329bc87e56d248df4a0ac /Lib/lib-old | |
parent | f808012f5e41b491c7348f8189e37c30b7cbf1a0 (diff) | |
download | cpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.zip cpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.tar.gz cpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.tar.bz2 |
changes for the Mac
Diffstat (limited to 'Lib/lib-old')
-rw-r--r-- | Lib/lib-old/find.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/lib-old/find.py b/Lib/lib-old/find.py new file mode 100644 index 0000000..ccd9fdb --- /dev/null +++ b/Lib/lib-old/find.py @@ -0,0 +1,26 @@ +import fnmatch +import os + +_debug = 0 + +_prune = ['(*)'] + +def find(pattern, dir = os.curdir): + list = [] + names = os.listdir(dir) + names.sort() + for name in names: + if name in (os.curdir, os.pardir): + continue + fullname = os.path.join(dir, name) + if fnmatch.fnmatch(name, pattern): + list.append(fullname) + if os.path.isdir(fullname) and not os.path.islink(fullname): + for p in _prune: + if fnmatch.fnmatch(name, p): + if _debug: print "skip", `fullname` + break + else: + if _debug: print "descend into", `fullname` + list = list + find(pattern, fullname) + return list |