import sys namepatternstartdir sys argv[ ]sys argv[ for name in find(namepatternstartdir)print(namethere' not much to this file--it' largely just minor extension to os walk--but calling its find function provides the same utility as both the deprecated find standard library module and the unix utility of the same name it' also much more portableand noticeably easier than repeating all of this file' code every time you need to perform find-type search because this file is instrumented to be both script and libraryit can also be both run as command-line tool or called from other programs for instanceto process every python file in the directory tree rooted one level up from the current working directoryi simply run the following command line from system console window run this yourself to watch its progressthe script' standard output is piped into the more command to page it herebut it can be piped into any processing program that reads its input from the standard input streamc:\pp \toolspython find py py more \launchbrowser py \launcher py \__init__ py \preview\attachgui py \preview\customizegui py more lines omitted for more controlrun the following sort of python code from script or interactive prompt in this modeyou can apply any operation to the found files that the python language providesc:\pp \system\filetoolspython from pp tools import find for filename in find find('py'')if 'walkin open(filenameread()print(filename\launcher py \system\filetools\bigext-tree py \system\filetools\bigpy-path py \system\filetools\bigpy-tree py \tools\cleanpyc py \tools\find py \tools\visitor py or just import find if in cwd notice how this avoids having to recode the nested loop structure required for os walk every time you want list of matching file namesfor many use casesthis seems conceptually simpler also note that because this finder is generator functionyour script doesn' have to wait until all matching files have been found and collectedos walk yields results as it goesand find find yields matching files among that set here' more complex example of our find module at workthe following system command line lists all python files in directory :\temp\pp whose names begin with complete system programs