ile1 = filenamefile2 = a+ os.sep
+filenameprint file2getfiles(filename, file2,top)print
"finished"
thanks!
--Senthil
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
HollandSent: Sunday, February 12, 2006 3:40 AMTo:
BruceCc: tutor pythonSubjec
HollandSent: Sunday, February 12, 2006 3:40 AMTo: BruceCc: tutor pythonSubject: Re: [Tutor] Changefiles Bruce,Thanks but is was not the solution. It goesthrough all the directories but does not seem to work.Here is the modifiedcode :-def getfiles(file1,file2,top): for
Bruce, Thanks but is was not the solution. It goes through all the directories but does not seem to work. Here is the modified code :- def getfiles(file1,file2,top): for root, dirs, files in os.walk(top): for name in dirs: print name for name in files: if name == file1: name =
for root, dirs, files in os.walk(top):
for name in dirs:
print name
for name in files:
This code looks suspicious. At this point, when we say name, what do we
expect to get here? Do you mean the directory name, or the file name?
It can't be both!
I wrote a little program that replaces all files called 'abcde' with the file in the directory from which you riun the program. However it does not find them (there is another one). What have I done wrong :- #this program copies the file x to all other places in the directory. #however it does not