xcopy local file backup and replication to remote server

Source: Internet
Author: User
Tags webdate

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.

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.