isfile/isdir problem
Alexander, Jason
jalexander at aivia.net
Thu Mar 2 11:56:37 EST 2000
Hello all,
With the help of you guys, I've got the directory traversal down pat (Thanks
again, by the way!). Now, I'm having issues with isfile and isdir returning
incorrectly. Here's the code:
import os;
sDirectory = "d:\data";
def process_directory(sArg, sDirName, lNames):
print "\nProcessing directory %s (%d items)..." %
(sDirName,len(lNames));
for sItem in lNames:
if (os.path.isdir(sItem)):
print " - Directory: %s" % sItem;
elif (os.path.isfile(sItem)):
print " - File: %s." % sItem;
else:
print " - Unrecognized: %s" % sItem;
os.path.walk(os.path.normpath(sDirectory), process_directory, "")
Basically, I'm finding that everything is returning as "Unrecognized",
except for my current directory, and any files within it. By the way, this
is on Win32.
Any ideas on what could be causing this? Is this a bug, or am I overlooking
something?
TIA,
-Jason
More information about the Python-list
mailing list