Just want to walk a single directory
timr at probo.com
Sun Jan 15 23:16:06 CET 2006
SB <stevebnospam428 at hotmail.com> wrote:
>I have a super-simple need to just walk the files in a single directory.
>I thought this would do it, but "permanentFilelist" ends up containing
>all folders in all subdirectories.
>Could someone spot the problem? I've scoured some threads using XNews reg
>expressions involving os.walk, but couldn't extrapolate the answer for my
>thebasedir = "E:\\temp"
>for thepath,thedirnames,thefilenames in os.walk(thebasedir):
> if thepath != thebasedir:
> thedirnames[:] = 
> for names in thefilenames:
Um, excuse me for butting in, but couldn't you accomplish the same thing
more simply by using os.listdir and os.path.isfile? In my brain, os.walk
is the solution to RECURSIVE search needs.
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list