When updating a website, there are usually not many files updated, but the files are in different directories. In this way, it is troublesome to back up the original file and update the file. If there are 7 front-end machines, it is really annoying. Therefore, this tool is available.
In fact, the xcopy command has been implemented. We only need to make good use of it. That is, copy the file to be updated to the backup directory, and then copy the files in the backup directory from the target directory. Copy the new file.
Code
@ Echo Off
Echo **************************************** ************
Echo * ** Version: V1 . 1 ***
Echo * ** Function: Copy all files in the specified directory to the specified directory ***
Echo * ** Back up existing files to the backup directory ***
Echo *** Written by: Niu kunliang, Hebei quantong Software Center 2009 - 2.19 ***
Echo **************************************** ************
If " % 1 " = "" Goto Input
If " % 2 " = "" Goto Input
Set SRC = % 1
Set Des = % 2
: Begin
If " % SRC % " = "" Goto Usage
If " % Des % " = "" Goto Usage
Echo ========================================================== ========
Echo Upgrade to be executed
Echo New file path: % SRC %
Echo Original file path: % des %
Set / P gotoend = " Press Y to continue. Other exits: "
If Not " % Gotoend % " = " Y " Goto End
Set Bakpath = Bak _ % Date :~ 0 , 10 % Time :~ 0 , 2 % Time :~ 3 , 2 % Time :~ 6 , 2 %
Xcopy " % SRC % \*.* " % Bakpath % \ / S
Xcopy " % Des % \*.* " % Bakpath % \ / S / U / R / Y
Xcopy " % SRC % \*.* " " % Des % \ " / S / R
Goto End
: Input
Set / P SRC = Enter the path name of the new file. ( Example: srcpath ):
Set / P des = Enter the path name of the original file (for example, despath ):
Goto Begin
: Usage
Echo Usage : Update Srcpath despath
: End
Echo Press any key Exit
Pause
[Url href = "http://files.cnblogs.com/evlon/update-tool.rar" ]update-tool.rar [/url]