This article first introduces a good file backup implementation, that is, backing up the mysql database regularly on a daily basis and backing up other files, you can also back up local files to a remote server.
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 |
Timed Incremental Backup
The website directory to be backed up is F:/WebDate. The directory saved after the backup is F:/WebDate-Back, and the log directory is F:/back-log.
Create a file named backup. bat with the following content:
The Code is as follows: |
Copy code |
If exist f:/back-log/log-te :~ 0, 102.16.txt del/F/S/q f:/back-log/log-te :~ 0, 102.16.txt |
# Delete a log file if it exists. Te :~ 0, get the first 10 digits of the date, my system date Format "date/t" is "Thursday", so get ". Adjust as needed.
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 a folder if it exists. Md f:/WebDate-Back/te :~ 0, 10% # Create a folder. Xcopy F:/WebDate-Back/te :~ 0, 10% // C/E/H/K/F/R/Y> F:/back-log/log-te :~ 0, 102.16.txt & time/T> F:/back-log/log-te :~ 0, 102.16.txt
# Copy the F:/WebDate folder to F:/WebDate-Back/te :~ At the same time, the copied file is output to the log file, and the xcopy directory is copied together. If exist f:/WebDate-Back/te :~ 0, 10% if exist f:/WebDate-Back/lDate % RD/S/q f:/WebDate-Back/lDate % |
Back up the instance to another Local Machine
A.net use // ip address password/user :******
B. xcopy file // ip address/
The batch file is backup. bat and the code is as follows:
========================================================== ========================================================== ==========
The Code is as follows: |
Copy code |
Net use // 192.168.1.198/ipc $ z1_198703/user: fig Xcopy g:/backup/*. * // 192.168.1.198/data backup/D/E/Y/H/K Net use // 192.168.1.198/ipc $/delete
|
The Xcopy command can be used
Xcopy Source Path target path
Copy files and directories, including subdirectories.