it onit will work regardless of which other tools are available thereall you need is python moreovercoding such tasks in python also allows you to perform arbitrary actions along the way--replacementsdeletionsand whatever else you can code in the python language walking one directory the most common way to go about writing such tools is to first grab list of the names of the files you wish to processand then step through that list with python for loop or other iteration toolprocessing each file in turn the trick we need to learn herethenis how to get such directory list within our scripts for scanning directories there are at least three optionsrunning shell listing commands with os popenmatching filename patterns with glob globand getting directory listings with os listdir they vary in interfaceresult formatand portability running shell listing commands with os popen how did you go about getting directory file listings before you heard of pythonif you're new to shell tools programmingthe answer may be "welli started windows file explorer and clicked on things,but ' thinking here in terms of less gui-oriented command-line mechanisms on unixdirectory listings are usually obtained by typing ls in shellon windowsthey can be generated with dir command typed in an ms-dos console box because python scripts may use os popen to run any command line that we can type in shellthey are the most general way to grab directory listing inside python program we met os popen in the prior it runs shell command string and gives us file object from which we can read the command' output to illustratelet' first assume the following directory structures-- have both the usual dir and unix-like ls command from cygwin on my windows laptopc:\tempdir / parts pp random bin spam txt temp bin temp txt :\tempc:\cygwin\bin\ls pp parts random bin spam txt temp bin temp txt :\tempc:\cygwin\bin\ls parts part part part part the parts and pp names are nested subdirectory in :\temp here (the latter is copy of the prior edition' examples treewhich used occasionally in this textnowas file and directory tools