Xcopy local file backup and copy to remote server

Source: Internet
Author: User
Tags webdate

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.