newb question: file searching
jaysherby at gmail.com
jaysherby at gmail.com
Tue Aug 8 16:31:05 EDT 2006
Mike Kent wrote:
> What you want is os.walk().
>
> http://www.python.org/doc/current/lib/os-file-dir.html
I'm thinking os.walk() could definitely be a big part of my solution,
but I need a little for info. If I'm reading this correctly, os.walk()
just goes file by file and serves it up for your script to decide what
to do with each one. Is that right? So, for each file it found, I'd
have to decide if it met the criteria of the filetype I'm searching for
and then add that info to whatever datatype I want to make a little
list for myself? Am I being coherent?
Something like:
for files in os.walk(top, topdown=False):
for name in files:
(do whatever to decide if criteria is met, etc.)
Does this look correct?
More information about the Python-list
mailing list