title: Iterate through folder passed as argument
body: <p>So a bit of background: I have one of those old mp3 players that if you just drag and drop a whole folder, it then plays the songs randomly. The solution I found is to move the files one by one. But, when you have lots of folders this can be time consuming.</p>
  
  <p>I am trying to make a script with Batch for Windows that moves file after file from one folder to another passed as parameters (ideally, it waits until the previous move is finished, so no moves are running in parallel. For now just added a timeout), but I am not sure if I am not using the right syntax or what I'm doing wrong (I've done a similar one in Shell, and it worked fine, but just curious).</p>
  
  <p>This is the code right now:</p>
  
  <pre><code>@echo off
  echo mvp3...
  
  IF %%1.==. GOTO No1
  IF %%2.==. GOTO No2
  
  set arg1=%1
  set arg2=%2
  echo before_for
  for /r %%i in (%%1) do (
      echo after_for
      move %%i %%2
      timeout 1
  GOTO End1
  
  :No1
    ECHO No param 1
  GOTO End1
  :No2
    ECHO No param 2
  GOTO End1
  
  :End1
  
  )
  </code></pre>
  
  <p>But if I try to run something like ./mvp3 C:\Users\folder1 C:\Users\folder2, this is the output:</p>
  
  <pre><code>mvp3...
  before_for
  The syntax of the command is incorrect.
  </code></pre>
  
  <p>I've done a bit of duckduckgoing but couldn't find the answer, can someone illuminate me?</p>
  
  <p>Thanks.</p>