Batch to compare last-modify from two files in different folders <p>I want a batch file that will compare the <code>last-modify</code> date of two different files located in two different folders. If the local file is older than the server file, I want to overwrite the local file.</p> <p>All I've found yet it a comparing the files with the <code>dir</code> command, which only works when both files are in the same folder (eg. <code>dir /b /OD file1.txt file2.txt</code>). </p> <p>This is what I got actually, just need to add the comparison:</p> <pre class="lang-bsh prettyprint-override"><code>set "source=\\server\myApp.otm" set "target=%userprofile%\Application Data\myApp\" copy /Y /B "%source%" "%target%" start outlook.exe /altvba "%target%\myApp.otm" </code></pre> <p>As you can see, the batch file is here to start Outlook with the <em>VBA</em> *OTM* file in parameter. I don't want to copy the 10MB file from the server each time if it isn't needed, thus the need for a comparison of <code>last-modify</code> dates (<code>filesize</code> would be okay too I guess).</p>