Normal local backup
The code is as follows |
Copy Code |
net stop MySQL xcopy D:/xx/data/bbb/*.* e:/cache/test/%date:~0,10%//y xcopy D:/xx/data/aa/*.* e:/cache/test/h/%date:~0,10%//y net start MySQL |
Scheduled incremental backups
The site directory to be backed up is: F:/webdate, the directory saved after the backup is: F:/webdate-back, the log directory is: F:/back-log.
Create a file named: Backup.bat, which reads as follows:
The code is as follows |
Copy Code |
IF EXIST f:/back-log/log-te:~0,10%.txt del/f/s/q f:/back-log/log-te:~0,10%.txt |
#如果日志文件存在则删除. te:~0,10% take the first 10 digits of the date, my system date format "date/t" is "2010-05-27 Thursday", so get "2010-05-27". Adjusted according to the situation.
The code is as follows |
Copy Code |
IF EXIST f:/webdate-back/te:~0,10% rd/s/q f:/webdate-back/te:~0,10% #如果文件夹存在, delete. MD f:/webdate-back/te:~0,10% #建立文件夹. xcopy F:/webdate f:/webdate-back/te:~0,10%//c/e/h/k/f/r/y >> F:/back-log/log-te:~0,10%.txt & Time /T >> F:/back-log/log-te:~0,10%.txt
#复制F:/webdate folders to f:/webdate-back/te:~0,10%/, and simultaneously outputs the copied files to the log file, which is replicated together with Xcopy directory. If EXIST f:/webdate-back/te:~0,10% if EXIST f:/webdate-back/ldate% rd/s/q f:/webdate-back/ldate% |
instance Local machine backup to other machines
a.NET use//IP address password/user:******
B.xcopy file//IP address/
The batch file is backup.bat with the following code:
=========================================================================================
The code is as follows |
Copy Code |
NET use//192.168.1.198/ipc$ Zqf198703/user:royalpeak xcopy G:/backup/*.*//192.168.1.198/Data backup/d/e/y/h/k NET use//192.168.1.198/ipc$/delete
|
You can do it with the Xcopy command.
xcopy Source Path target path
Copy files and directories, including subdirectories.