Use batch processing to generate date (time) files and folders

Source: Internet
Author: User
Helped others back up SQL server automatically yesterday
Failed to use network ing drive as backup file storage path
The ephemeral disk space is insufficient.
So I decided to back up only the latest 2-day data on the local machine.
Write another batch for system scheduling.
Copy the backup data to the network drive every week for archival purposes

How to find files generated by batch processing on the Internet
Below is a better implementation

Batch file: @ Echo   Off
Set Afile = Bak -% Date: ~ 4 , 4 % Date: ~ 9 , 2 % Date: ~ 12 , 2 %
Set Bfile = Bak -% Time: ~ 0 , 2 % Time: ~ 3 , 2 % Time: ~ 6 , 2 %
Set Cfile = Bak -% Date %
Echo afile = % Afile %
Echo bfile = % Bfile %
Echo cfile = % Cfile %

Output:
Afile = bak-20061219
Bfile = bak-113202
Cfile = Bak-Tuesday 2006-12-19

So back up bat.@ Echo off
ECHO is backing up data to the network drive...
Set folder = % date %
MD "Y: \ % folder %"
Copy D: \ databak \ *. Bak "Y: \ % folder %"
Echo backup is complete.

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.