-_debug = 0
-_prune = ['(*)']
-
-def find (pattern, dir = os.curdir):
- lst = []
- 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):
- lst.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`
- lst = lst + find (pattern, fullname)
- return lst
+def find (pat, dir):
+ f = os.popen ('find %s -name "%s"'% (dir, pat))
+ lst = []
+ for a in f.readlines():
+ a = a[:-1]
+ lst.append (a)
+ return lst
+
+