title: Batch - xcopy files older than x minutes
body: <p>after a new file creation time of 20 min I want to copy all files with the extensions <code>.txt</code>  from Folder <code>New</code> to Folder <code>Target</code>. (I want to copy olny files are older than 20 min)</p>
  
  <p>So far, it looks like this:</p>
  
  <pre><code>set hh=%TIME:~0,2%
  set mm=%TIME:~3,2%
  set ss=%TIME:~6,2%
  
  set /a sum_sec=%hh% * 3600 + %mm% * 60 + %ss% -300
  
  set /a h=%sum_sec% / 3600
  set /a m=(%sum_sec%/60) - 60 * %h%
  set /a s=%sum_sec% - 60 * (%sum_sec%/60)
  IF %h% LSS 10 set h=0%h%
  IF %m% LSS 10 set m=0%m%
  IF %s% LSS 10 set s=0%s%
  
  set new_time=%h%:%m%:%s%
  </code></pre>
  
  <p>So far I've only delete files that are older than 20 minutes:</p>
  
  <pre><code>forfiles /P "C:\Users\Desktop\Start" /S /M *.txt /C "cmd /c if @ftime LSS %new_time% del /F /Q @path"
  </code></pre>
  
  <p>My Question now is how can I copy new files from Folder <code>New</code> to Folder <code>Target</code> after 20 minutes ? </p>
  
  <p>Best regs</p>