We have a file share that has a directory containing all of our build version direcotries named like this
WebApp_20140702.1
first number being date second number being the build count for that date
these are then contained in the following directory
\servershareproduct
What i need to do from a virtual machine is create a batch file that can check the target location on my vm ie. c:product
see if it has the latest version from the network share either by comparing the file names or dates, then copy the new version and delete the old if necessary.
So far i can copy the folder over using xcopy
but that's about the extent of my dos/batch file knowledge iv had a look around for a while but haven't been able to see anything that i can use
This is what i have so far, as you can see though i dont know how to do the comparison between the two directories as explained above.
xcopy "\serversharewebapp" "c:usersusernamedesktopwebapp" /E /K
I did try to use just /D
at the end and just copying the directories from \servershareproduct
that had a later date than the target but it ended up just copying the whole directory.
EDIT : to make my self clear
i need to find out if i have the latest sub directory but no matter what i do it always copies all the sub directories from \servershareproduct
ie. the \servershareWebApp
directory will have the following sub dirs
..WebApp_20140628.1
..WebApp_20140628.2
..WebApp_20140703.1
and my vm will have the directory
c:productWebApp_20140628.2
Now i need to be able to go into the file share see that it has a more up to date subdirectory i need to copy that directory to my vm and then delete the older one from my vm so i would then have
c:productWebApp_20140703.1
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…