A small example of using the bat command to copy folders for backup

Source: Internet
Author: User

 

@ Echo offset sourcr_path = D: \ 1 Set dd = % Date :~, 10% set TT = % time :~, 8% echo % DD % TT % set target_path = D: \ % DD % echo % target_path % if exist % sourcr_path % (the echo directory to be copied is D: \ 1) if not exist % sourcr_path % (echo Directory D: \ 1 to be copied does not exist goto end) if exist % target_path % (RD/Q/S % target_path % echo % target_path % already exists, to copy it, delete it) if not exist % target_path % (mkdir % target_path % echo % target_path % created successfully) xcopy % sourcr_path % target_path %/S/eecho backup successful: endpause

 

Print:

2012-07-17 17:09:35
D: \ 2012-07-17
The directory to be copied is D: \ 1.
D: \ 2012-07-17 already exists. to copy it, delete it successfully
D: \ 2012-07-17 created successfully
D: \ 1 \ 10.txt
D: \ 1 \ 11 \ 11.txt
Two files are copied.
Backup successful
Press any key to continue...

 

 

 

 

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.