the fact that it fails shoul be due to some windows restriction about trash &amp; some hidden files, <br>to bypass that you can add&nbsp; a filter in here <br><br>def walk(dir):<br>
 &nbsp; for name in os.listdir(dir):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #the following line is the filter<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if name != &#39;Trash can&#39; or name !=&nbsp; &#39;some hidden directory name&#39;:<br>
 &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; path = os.path.join(dir,name)<br>
 &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if os.path.isfile(path):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .....<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else: <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass<br>