I would like to write a batch file containing DOS commands (unfortunately perl or another language is not an option) to do the following task.
In one directory (c:\MyData\Directory1) there are the following files:
File2.txt
File2.dat
FileA.bin
FileQ.bin
FileC.bin
File8.bin
File2.bin
These files all have different creation dates. The most recently created *.bin file is File2.bin in this example, but it could be any randomly named *.bin file.
In another directory (c:\MyData\Directory2) there are the following files:
File2.txt
File2.dat
FileA.bin
FileQ.bin
Here is what I want to do:
Copy all files with the extension *.bin in Directory1 that do not already exist in Directory2 except for the most recently created *.bin file in Directory1. So the only files that should be copied into Directory2 are:
FileC.bin - Copy because it's a bin file that's not yet in Directory2
File8.bin - Copy because it's a bin file that's not yet in Directory2
The following files should not be copied into Directory2:
File2.txt - Wrong extension so don't copy it
File2.dat - Wrong extension so don't copy it
FileA.bin - Already exists in Directory2 so don't copy it
FileQ.bin - Already exists in Directory2 so don't copy it
File2.bin - Most recent *.bin file so don't copy it
Thanks for any help!