I have a batch file that runs when I build my solution in VS2019. The .bat file uses xcopy to copy .dlls from my project's Debug folder to another destination direction.
I want to use xcopy to copy the files to a subfolder in that destination directory. The only problem is, the name of the subfolder that I want to copy to will always be changing, since the subfolders in the destination directory are created whenever I do a new build for distribution to customers.
For example, right now the destination directory contains the following folders, which are named after the builds of all the previously distributed .dlls:
MySuperSoftware21.4.8055.22312
MySuperSotware21.4.1110.34622
.
.
.
etc.
Today the destination directory will have a new subdirectory like so:
MySuperSoftware22.1.8119.20613
MySuperSoftware21.4.8055.22312
MySuperSotware21.4.1110.34621
.
.
.
etc.
and I want xcopy to copy the latest .dll to the newly created subdirectory only.
I could either use the newest subdirectory date or the subdirectory build number. I looked through the list of xcopy switches and couldn't find one applicable to this situation. Is this possible?
robocopy
, which is included in Windows. It has way more options than xcopy.RoboCopy
parameter/Mon:1
,/XO
, or/MinAge:1
(example)