title: Need a renaming script that strips filenames and adds folder name with increments
body: <p>I need a script that will allow me to strip filenames to files that are placed within folders, and apply the folder names to the files, and add an incremental number to the end of each filename.</p>
  
  <p>So the filenames would look something like this in their original state:</p>
  
  <pre><code>gdgeregdja34gtj.jpg
  </code></pre>
  
  <p>And then look like this after the script is executed:</p>
  
  <pre><code>foldername&gt;foldername001.jpg
  foldername&gt;foldername002.jpg
  </code></pre>
  
  <p>I have this script, which allows the folder name to prefix any filename of files within folders. But it doesn't strip the filenames.</p>
  
  <pre><code>@echo off
   pushd "Folder"
    for /d %%D in (*) do (
      for %%F in ("%%~D\*") do (
       for %%P in ("%%F\..") do (
      ren "%%F" "%%~nxP_%%~nxF"
    )
   )
  )
  popd
  </code></pre>