Walk thru each subdirectory from a top directory
silverburgh.meryl at gmail.com
silverburgh.meryl at gmail.com
Mon Feb 26 16:28:20 EST 2007
i am trying to use python to walk thru each subdirectory from a top
directory. Here is my script:
savedPagesDirectory = "/home/meryl/saved_pages/data"
dir=open(savedPagesDirectory, 'r')
for file in dir:
if (isdir(file)):
# get the full path of the file
fileName = savedPagesDirectory + file + 'index.html'
print fileName
$ ./scripts/regressionTest.py
Traceback (most recent call last):
File "./scripts/regressionTest.py", line 12, in ?
dir=open(savedPagesDirectory, 'r')
IOError: [Errno 21] Is a directory
But I get the above error:
Can you please tell me what did I do wrong?
Thank you.
More information about the Python-list
mailing list