XCOPY or FORFILES
Posted on 2005-04-26
Hi there. I simply need to copy a file from a directory on one machine to a directory on another box for processing. We receive these files daily except for Saturday. There are many other files in the source directory, and I'm unsure how to specify that I get only the most recent file. I assumed I'd just use either xcopy or forfiles within a .bat file and then run it w/windows scheduled tasks. Again, my problem is I don't know how to tell it to retrieve the most recently dated file. For example, right now it would copy \\server1\bb\filename_04252005 to \\server2\g$\mssql\tools\filename_04252005. Can anybody tell me the best way to do this?