title: bulk rename files within a folder to parent folder name
body: <p>I have a large (aprox. 150,000) tif files, which all have the same filename. They are only unique because of the directory structure they are held in.</p>
  
  <p>I would like to bulk rename the tiff files so they become unique, based on the directory structre that they are held within.</p>
  
  <p>Does anyone have any method of acheiving this?</p>
  
  <p>I am using Windows Server 2012 so a solution using a cmd script, batch file or windows GUI tool would be perfect.</p>
  
  <p>Ideally, this is what I would like to acheieve, but if I have to have more or all of the directory structure in the final filename thsi would still be very, very helpful.</p>
  
  <pre><code>C:\A_001\B_0001\ABC\0001.tif -&gt; ABC.tif
  
  C:\A_001\B_0001\JKL\0001.tif -&gt; JKL.tif
  
  C:\A_001\B_0001\XYZ\0001.tif -&gt; XYZ.tif
  
  C:\A_001\B_0002\123\0001.tif -&gt; 123.tif
  
  C:\A_001\B_0002\456\0001.tif -&gt; 456.tif
  
  C:\A_001\B_0002\789\0001.tif -&gt; 789.tif
  </code></pre>