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).<br> What have I done wrong :-<br> #this program copies the file x to all other places in the directory.<br> #however it does not go to the right places<br> def getfiles(file1,file2,top):<br> for root, dirs, files in os.walk(top):<br> for name in dirs:<br> for name in files:<br> if name == file1:<br> shutil.copy(file2,name)<br> print "copied one file"<br> <br> import os<br> import shutil<br> #main<br> top = '/home'<br> a =
os.getcwd()<br> filename = 'abcde'<br> file1 = filename<br> file2 = a+'/'+filename<br> getfiles(file1, file2,top)<br> print "finished"<br> <br> <br> <p>
                <hr size=1><font face="Arial" size="2">To help you stay safe and secure online, we've developed the all new <a href="http://us.rd.yahoo.com/mail/uk/taglines/default/security_centre/*http://uk.security.yahoo.com/"><b>Yahoo! Security Centre</b></a>.</font>