title: Append folder name to file name and move file using DOS batch
body: <p>There is folder structure like this:</p>
  
  <pre><code>rootfolder\subfolder1\file1.txt
  rootfolder\subfolder1\fileA.txt
  rootfolder\subfolderX\file2.txt
  rootfolder\subfolderX\fileC.txt
  </code></pre>
  
  <p>Need to append the foldername to the filename and include current datetime. Then move the renamed file to the rootfolder i.e. like below:</p>
  
  <pre><code>rootfolder\subfolder1_file1_&lt;datetime&gt;.txt
  rootfolder\subfolder1_fileA_&lt;datetime&gt;.txt
  rootfolder\subfolderX_file2_&lt;datetime&gt;.txt
  rootfolder\subfolderX_fileC_&lt;datetime&gt;.txt
  </code></pre>
  
  <p>Does anyone know script that can do this? Thanks a lot!</p>