Staging
v0.5.1
https://github.com/python/cpython
Revision a8a277cbdc32c06fe59465fc3f8bc260dc7d82ea authored by Jack Jansen on 09 October 1995, 23:27:06 UTC, committed by Jack Jansen on 09 October 1995, 23:27:06 UTC
1 parent 9bd2d97
Raw File
Tip revision: a8a277cbdc32c06fe59465fc3f8bc260dc7d82ea authored by Jack Jansen on 09 October 1995, 23:27:06 UTC
Fixed positioning of icon on copy()
Tip revision: a8a277c
find.py
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
back to top