title: Move a single file by extension with a batch file
body: <p>this is my very first post on this site but as I already found much help on stackoverflow, I now ask this question myself. I did not find an answer to this issue. My English isn't that good and as my Problem is quite complex, I hope you guys are all able to understand me. If not or if there are any questions that are needed to be able to help me, feel free to ask.</p>
  
  <p>So I want to make a Batch file that moves files by the Extension (in my case, it's .pdf) but not all of them. I know there is this command:</p>
  
  <pre><code>move "Y:\Scan\*.pdf" "Y:\Scan\Archive\"
  </code></pre>
  
  <p>But this will move all pdf files to the Archive Folder and I don't want that.
  To get a better overview what my plan is, a small description is needed I guess.
  Imagine you have a home Server and your Computer is connected to it, a Printer and a scanner aswell. I have many documents in Folders in my home Office and I want to have them all on my Server. This is done trough scanning all Sheets of paper in These Folders. Everytime I scan something, this is saved as .pdf in a Folder on my local Computer, sorted by time and Looks like this: 2017-06-15-10-30.pdf</p>
  
  <p>My current script is asking 3 times for userinput. One time for a village Name, one time for a street's Name and one time for the number of the house because the Folders for the Archive should be named like the corresponding house they are referring to. So I have These 3 Inputs in my Batch already and also the whole Folder Name saved in a new variable.</p>
  
  <p>My plan is to now ask the user how many pdf's are corresponding to the last created Folder and whatever the user is typing, this amount of files will be stored in that Folder. To understand this a Little better, here is what i've done so far (my Batch code).</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>@echo off
  cls
  
  title Archive-Script (by Relentless)
  color 0b
  
  
  :reset
  cls
  
  REM This is the village's name
  SET ON=""
  REM This is the street's name
  SET SN=""
  REM This is the number of the house
  SET HN=""
  REM This is a variable to store whether the user wants to reset the variables or not (used later)
  SET RESET=""
  
  
  :start
  cls
  IF %RESET% == N echo To overwrite the village's name, please enter the name again and hit enter. If you don't want to overwrite the name, just hit enter!
  IF NOT %RESET% == N echo Please enter the village's name (confirm by pressing enter):
  IF %RESET% == N echo Current name: %ON%
  set /p "ON="
  echo The village's name was set to %ON%!
  
  echo.
  
  IF %RESET% == N echo To overwrite the street's name, please enter the name again and hit enter. If you don't want to overwrite the name, just hit enter!
  IF NOT %RESET% == N echo Please enter the street's name (confirm by pressing enter):
  IF %RESET% == N echo Current name: %SN%
  set /p "SN="
  echo The street's name was set to %SN%!
  
  echo.
  
  IF %RESET% == N echo To overwrite the house's number, please enter the number again and hit enter. If you don't want to overwrite the number, just hit enter!
  IF NOT %RESET% == N echo Please enter the house's number (confirm by pressing enter):
  IF %RESET% == N echo Current number: %HN%
  set /p "HN="
  echo The house's number was set to %HN%!
  
  echo.
  echo.
  echo.
  echo.
  echo.
  
  SET FOLDERNAME="%ON%, %SN% %HN%"
  echo The folder %FOLDERNAME% will now be created!
  mkdir ""%FOLDERNAME%""
  timeout /t 2 /nobreak
  
  
  :pdfmove
  cls
  echo How many pdf-files are corresponding to the latest created folder?
  set /p "PDF="
  for /l %%x in (1,1,%PDF%) do (
   echo %%x
   move Y:\Scan\*.pdf Y:\Scan\%FOLDERNAME%\
  )
  
  
  :resetoption
  cls
  echo %ON%
  echo %SN%
  echo %HN%
  echo.
  echo Should the variables be resetted again? (J/N)
  set /p "RESET="
  IF %RESET% == J goto reset
  IF %RESET% == N goto start</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see, I already tried to implement the move Option, but this will move ALL pdf files instead of one on each for Loop. Can anyone help me with that? I guess the code is pretty simple to understand.</p>
  
  <p>Greetz Relentless</p>