title: Renaming multiple video files using RE and OS
body: <p>I recently downloaded a large number of <code>mkv</code> files with names formatted like "South Park S01E01 Cartman Gets an Anal Probe (640x480) [Phr0stY].mkv". I want to strip all of the text except for the actual episode names. Here is the code I have so far.</p>
  
  <pre><code>rootdir = '/Users/me/Documents/Test/'
  for ii in os.listdir(rootdir):
      try:
          for kk in os.listdir(rootdir + ii):
              try:
                      new = re.sub('South\sPark\sS[0-9][0-9]E[0-9][0-9]\s', '', kk)
                      new1 = re.sub('\s\([0-9]+x[0-9]+\)\s\[Phr0stY\]', '', new)
                      os.rename(rootdir + ii + kk, rootdir + ii + new1)
              except:
                      pass
      except:
          pass
  </code></pre>
  
  <p>Everything works fine up until the <code>os.rename</code> line where it stops and causes the <code>except</code> clause to execute. When I print <code>new1</code> the correct string is returned. Can anyone see why the rename isn't working?</p>