Why doesn't this work as expected?
David LeBlanc
whisper at oz.nospamnet
Tue Jun 5 04:34:45 EDT 2001
I'm trying to build a directory walker, doing some work on each actual
file found in each directory. However, when I run the below code snippet
on a directory containing both sub-directories and files, it says that
all are not dirs.
What is not right?
TIA,
Dave LeBlanc
import sys
import os
import dircache
import re
def getDirs():
print dircache.listdir("l:/languages/python")
for dir in dircache.listdir("l:/languages/C"):
if os.path.isdir(dir):
print dir, "is a dir"
else:
print dir, "is not a dir"
getDirs()
More information about the Python-list
mailing list