title: XCOPY with pattern matching
body: <p>I am very new to Windows batch scripting so please ignore if it is stupid question, I have a requirement of copying set of files from source to destination only if source file is modified after certain date_time, I managed to do it using XCOPY command. </p>
  
  <pre><code>XCOPY C:\Src\*.txt C:\Target /D /S /Y
  </code></pre>
  
  <p>This runs fine for first run, now the twist is once destination folder file is processed it will be renamed to some other name and extension, so when next time my script runs it does not find same file name as source in the destination folder because it is processed and renamed. So is there a way in XCOPY or any other Windows command to do the pattern match for the file name int the destination folder and if match found then proceed with date_time check and copy or else ignore?</p>
  
  <p>Example Source Dir Files:</p>
  
  <pre><code>a.txt
  b.txt
  c.txt
  </code></pre>
  
  <p>Destination Dir Files After first script run:</p>
  
  <pre><code>a.txt
  b.txt
  c.txt
  </code></pre>
  
  <p>Destination Dir Files after processing and before running the script second time:</p>
  
  <pre><code>a_201603071130.ok
  b_201603071130.ok
  c_201603071130.ok
  </code></pre>
  
  <p>For second run of the script with XCOPY it does not find the file a.txt in destination as it is processed but the requirement is to copy only if a.txt file is modified after last run.</p>
  
  <p>I can do this by storing the last run time and checking that for next run etc. but I wanted to find out if there is any other way of doing it.</p>