title: rename subfolders in a directory - python
body: <p>I want to rename all subfolders within a directory using python. I thought this was fairly easy but since i'm new to python and programming in general i'm assuming i'm missing something key.</p>
  
  <p>Here is my folder structure: C:\Users\DBailey\Desktop\Here</p>
  
  <p>-there are two folders with this folder named: 3303_InfigenSolar and 3304_FurnaceCanyon</p>
  
  <p>-within these folders are 4 other subfolders and within those folders are a bunch of files.</p>
  
  <p>I want to batch rename only <strong>3303_InfigenSolar</strong> and <strong>3304_FurnaceCanyon</strong> so that they read <strong>3303_InfigenSolar_08315</strong> and <strong>3304_FurnaceCanyon_08315</strong></p>
  
  <p>Here is my code thus far:</p>
  
  <pre><code>now = datetime.datetime.now()
  month = "0" + str(now.month)
  day = now.day
  year1 = str(now.year)
  year2 = year1[2:]
  date = str(month) + str(day) + str(year2)
  newname = fn + "_" + str(date)
  
  dir = 'C:\Users\DBailey\Desktop\Here'
  folder = os.listdir(dir)
  for fn in folder:
      print newname
      os.rename(fn, newname)
  </code></pre>
  
  <p>When I run the script - only one folder is printed (there are only two folders but more will be added)and I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;interactive input&gt;", line 2, in &lt;module&gt;
  WindowsError: [Error 2] The system cannot find the file specified
  </code></pre>