On 2006-08-12 09:46:54 -0700, "KraftDiner" <[EMAIL PROTECTED]> said:
> Hi I need help writing a python script that traverses (recursivly) a
> directory and its sub directories and processes all files in the
> directory.
In addition to os.walk, I find Jason Orendorff's 'path' module very
helpful
Use os.system to execute a string and os.walk to get a recursive list of files
>>> def processdir(curdir,subdirs,files):
... map(lambda f:os.system('\\cygwin\\bin\\wc -l "%s"' % f),
[curdir+os.sep+x for x in files])
...
>>> map(lambda x:processdir(*x), os.walk('\\dev\qclient'));
6 \dev\qclie
KraftDiner wrote:
> Hi I need help writing a python script that traverses (recursivly) a
> directory and its sub directories and processes all files in the
> directory.
There's a great os.walk + wrapper in the Python cookbook. I once had an
unrelated problem with it, but check it out and see if it
KraftDiner wrote:
> Hi I need help writing a python script that traverses (recursivly) a
> directory and its sub directories and processes all files in the
> directory. So at each directory if there are files in it I must build
> a list of those files and process them by exectuing a system command
KraftDiner wrote:
> Hi I need help writing a python script that traverses (recursivly) a
> directory and its sub directories and processes all files in the
> directory. So at each directory if there are files in it I must build
> a list of those files and process them by exectuing a system comman
Hi I need help writing a python script that traverses (recursivly) a
directory and its sub directories and processes all files in the
directory. So at each directory if there are files in it I must build
a list of those files and process them by exectuing a system command
(exec?)
Can some one tel