title: Convert windows-1251 directory names to unicode (using Python)
body: <p>I used a php-script to create directories, using words (categories names) that I've fetched from a site (utf-8), but when I created those directories, I see that there are unreadable characters instead of real words. </p>
  
  <p>AFAIK PHP under Windows is working within <code>cp1251</code> locale and can't work with <code>utf-8</code> filenames/dirnames.</p>
  
  <p>So the question is, is it possible to use Python to walk over all of the directories and rename them to utf-8 charset?</p>
  
  <p>Looks like that piece of code works, now i only need to make recursive walk through the dirs and rename all of them.</p>
  
  <pre><code>basedir = "C:\\Users\\alex\\Desktop\\1\\save"
  dirs = os.listdir(basedir)
  for fn in dirs:
      print fn
      nn = fn.decode('utf-8')
      os.rename(os.path.join(basedir,fn), os.path.join(basedir,nn))
  </code></pre>