title: OSError: [Errno 39] Directory not empty , what is the error?
body: <p>I tried this code for rename a lot directories but I had this error "OSError: [Errno 39] Directory not empty".</p>
  
  <pre><code>import os
  for ce in os.listdir("."):
      z = None;
      co = ce;
      if co[0]=="(":
          c = co.find(")",4);
          z = co.replace(ce[0:c+1],"");
          os.rename(ce,z);
          print z
  </code></pre>
  
  <p>Did I do anything wrong?</p>
  
  <p>I have seen that it can be solved if I delete folders with the same name but there are too many and I can not see which, if I try to do it from the script I could delete both, what do you recommend?</p>