Write a file backup script (private backup) under Windows _dos/bat

Source: Internet
Author: User
Today an accident, I wrote the diary of the big half month the encrypted file is damaged and cannot be recovered. He decided to write a dedicated backup script file.
The main idea is to create a folder under current directory backup based on today's date, and then copy the files to that folder.
The script files are as follows:
Copy Code code as follows:

echo off

Echo ******** starts backing up log files ********

Set ymd=%date:~0,4%%date:~5,2%%date:~8,2%

Set backup-dir=backupnotebook-%ymd%

Echo Backup directory:%backup-dir%

Echo--------------------------------

If not exist%backup-dir% (

mkdir%backup-dir%

)

Copy *.NB%backup-dir%

echo ********* log backup complete!*********
Pause

The script will be executed automatically every time the journal is finished.
With this script, I believe that there will be no similar problems in the future!

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.