title: Directory not empty error while renaming folders
body: <p>Im trying to rename folders,</p>
  
  <p>This is what i have,</p>
  
  <pre><code>for item in all_folders:
      root_path = '/media/username/da5df9e4-cdc6-4d55-91e8-b2383e89165f/lion/'
          new_root_path = root_path+item
          for folders in os.listdir(root_path+item):
              for index,value in enumerate(all_combined):
                  if folders.startswith(all_combined[index]):
                         os.rename(os.path.join(new_root_path,folders),os.path.join(new_root_path,'New'))
  </code></pre>
  
  <p>When i run this i get:</p>
  
  <pre><code>---------------------------------------------------------------------------
  OSError                                   Traceback (most recent call last) 
  &lt;ipython-input-320-a1b27e11ba34&gt; in &lt;module&gt;()
        4     for index,value in enumerate(all_combined):
        5         if folders.startswith(all_combined[index]):
  ----&gt; 6                     os.rename(os.path.join(new_root_path,folders),os.path.join(new_root_path,'New'))
  
  OSError: [Errno 39] Directory not empty: '/media/username/da5df9e4-cdc6-4d55-91e8-b2383e89165f/lion/Tpct046/5mm portal' -&gt; '/media/username/da5df9e4-cdc6-4d55-91e8-b2383e89165f/lion/Tpct046/New'
  </code></pre>
  
  <p>all_folders list looks like this:</p>
  
  <pre><code>['t0118',
   't046',
   't042',
   't003',
   't024',
   't016',
   't011',
   't065',]
  </code></pre>
  
  <p>The all_combined list looks like this:</p>
  
  <pre><code> all_combined = ['Thin Venous Phase',
   'VENOUS THIN',
   'Tripple Phase',
   'Thin Venous Phase',
   'Thin Venous Phase',
   'Thin Venous Phase',
   '5MM VEN0US',
   'ARTERIAL THIN_0081',
   'ARTERIAL THIN_0100',.........]
  </code></pre>
  
  <p>Any suggestions what may help would be useful,Thanks in advance.</p>