Just want to walk a single directory

SB stevebnospam428 at hotmail.com
Sat Jan 14 23:44:19 CET 2006


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"

permanentFilelist= []

for thepath,thedirnames,thefilenames in os.walk(thebasedir):
    	if thepath != thebasedir:

    	    	thedirnames[:] = []

    	for names in thefilenames:


More information about the Python-list mailing list