I would like to write a VBScript or .bat file to move the two most recent files of a specific extension *.sch
in directory a to a different directory.
I have experimented with $newest
How do I find second newest?
Thanks
I would like to write a VBScript or .bat file to move the two most recent files of a specific extension *.sch
in directory a to a different directory.
I have experimented with $newest
How do I find second newest?
Thanks
In VBScript you could do it like this:
Edit: The above code isn't too extensible, though. If you need more than just the most recent 2 files you may want to take a slightly different approach. Create an array the size of the number of files you want to handle, and do a sorted insert as long as you have free slots or the current file is newer than the oldest file already in the array.
An alternative would be shelling out to the CMD-builtin
dir
command and reading its output: