title: Batch file to move file based on Month & Year on Date modified to folder with YYYY_MM
body: <p>Anyone can help me to create a batch file to move *.xml file from the X folder to YYYY_MM folder based on Month &amp; year on date modified xml file?</p>
  
  <p>I am not sure what to put inside the loop.</p>
  
  <pre><code>@echo off
  
  echo Date is %Date%
  dir /od/b "C:\Users\*.xml" &gt; test.log
  for /F %%f in (test.log) DO
  (
  
  )
  </code></pre>
  
  <p>at first I want to put <code>set var = %%~tf</code> inside the loop so that later I can use substring on var to get month and year and I can move the xml file to the YYYY_MM folder based on that, but seems that it's not working.</p>