read list of dirnames and search for filenames
fscked
fsckedagain at gmail.com
Tue May 1 16:35:21 EDT 2007
I cannot seem to get this to work. I am hyst trying to read in a list
of paths and see if the directory or any sub has a filename pattern.
Here is the code:
import os, sys
from path import path
myfile = open("boxids.txt", "r")
for line in myfile.readlines():
d = path(line)
for f in d.walkfiles('*Config*.xml'):
print f
And here is my error:
Traceback (most recent call last):
File "Untitled.py", line 21, in ?
for f in d.walkfiles('*Config*.xml'):
File "C:\Python24\Lib\site-packages\path.py", line 460, in walkfiles
childList = self.listdir()
File "C:\Python24\Lib\site-packages\path.py", line 328, in listdir
names = os.listdir(self)
WindowsError: [Errno 3] The system cannot find the path specified: u'X:
\\Instructions\\97544546294\n/*.*'
What I don't get is if I just print the path it prints correctly, but
it keeps adding double "\"s to it.
I tried changing the backslashies to forward slashies and I get :
WindowsError: [Errno 3] The system cannot find the path specified:
u'X:/Instructions/97544546294\n/*.*'
help?
More information about the Python-list
mailing list