title: Script to rename files to parent folder, move renamed file and delete empty folder
body: <p>Wondering if anyone here can help me out. I'm using Windows 7 and have a collection of movies and TV shows in individual folders which I'd like to be renamed to that of the folder name. For example:</p>
  
  <pre><code>../Media Files/Example Movie (2013)/EM2013.avi
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>../Media Files/Example Movie (2013)/Example Movie (2013).avi
  </code></pre>
  
  <p>I'd then like the newly named file to be moved to the <code>Media Files</code> folder, and for the (then empty) folder to be deleted. So:</p>
  
  <pre><code>..Media Files/Example Movie (2013).avi
  </code></pre>
  
  <p>I've searched for a solution but only found scripts which do one or the other (<a href="https://stackoverflow.com/questions/14055495/how-to-rename-a-file-according-his-folder-name-via-batch-script">How to rename a file according his folder name via batch script</a>) - I'm after a script that can do all three things in one go as I will be adding movies and TV shows to the <code>Media Files</code> folder on a regular basis. Thanks in advance to anyone that can help and apologize if anything similar has been asked before.</p>