title: How to copy files from one folder to another folder using xcopy or robocopy?
body: <p>Below is the code to copy files from one folder to another folder and it works. However,I get new files generated everyday with small change in name. This code does not copy those new files when filename is simply modified.</p>
  
  <pre><code>@echo off
  setlocal disableDelayedExpansion
  set "file="
  for /f "eol=: delims=" %%F in ('xcopy /dl "C:\Users\TMM\Desktop\fol2\*" "\\Folder2\TS\Test"') do (
    if defined file (
      setlocal enableDelayedExpansion
      copy "!file!" "\\Folder2\TS\Test" &gt;nul &amp;&amp; echo "!file!" || echo FAILED: "!file!"
      endlocal
    )
    set "file=%%F"
  )
  </code></pre>