title: Win CMD, move file to a directory depending on the file date
body: <p>I am trying to write a Windows 7 batch script that moves the pics of my camera on a SD card to a directory on the HDD of my computer. This directory should contain the year and the month of the creation date of the pic.</p>
  
  <p>Example file: <code>E:\DCIM\100CANON\IMG_0190.jpg, 2012/12/31</code></p>
  
  <p>To: <code>C:\Users..Pictures\2012\12\</code></p>
  
  <p>My idea was writing FOR loops for the year, month and day and then moving the files which are newer then the resulting date:</p>
  
  <pre><code>FOR /L %%Y IN (2014,-1,2011) DO ( FOR /L %%M IN (12,-1,1) DO ( FOR /L %%D IN (31,-1,1) DO ( ROBOCOPY E:\DCIM\100CANON\ C:\Users..Pictures\%%Y\%%M\ *.* /MAXAGE:%%Y%%M%%D /MOVE ) ) )
  </code></pre>
  
  <p>But that does not work becaues of the missing 0 in the months and days below 10...</p>
  
  <p>Unfortunately, I have not got a good knowledge in Windows batch files coding.</p>