Regularly compress the backup file (folder) and upload it to the backup server through FTP for Batch Processing

Source: Internet
Author: User

Regularly compress the backup file (folder) and upload it to the backup server (BAT) through FTP)
Rem regularly backs up files and uploads them to the backup server over FTP
Rem folder to be backed up (Multiple folders are separated by spaces)
Set bak_webfile = E: \ sman \ webfile E: \ sman \ datafile
Rem Temporary Folder
Set bak_tmpfile = c :\~ Smantemp \
Rem log folder
Set bak_logpath = c :\~ Bak_log \
RAR file name generated by Rem
Set bak_bakfile = yyyymmdd (page backup)
Rem current date (Format: yyyymmdd)
Set bak_date = % Date :~ 0, 4% % Date :~ 5, 2% % Date :~ 8, 2%

Rem FTP Information
Set bak_ftpserver = 127.0.0.1 88
Set bak_ftpusername = test
Set bak_ftpuserpass = 123

Set bak_timestart = % time %
MD % bak_tmpfile %
MD % bak_logpath %

Echo -------- start to compress [% bak_timestart %]> %bak_logpath1_log-baibak_date1_.txt

"C: \ Program Files \ WinRAR \ rar.exe" a-Ag + % bak_bakfile % bak_tmpfile % bak_webfile %

Echo -------- after compression is completed, start uploading [% time %/% bak_timestart %] >>% bak_logpath#log-?bak_date=.txt

Rem generates an FTP command file
Echo open % bak_ftpserver %> ftp. sman
Echo % bak_ftpusername %> ftp. sman
Echo % bak_ftpuserpass %> ftp. sman
Echo bin> ftp. sman
Echo mkdir % bak_date %> ftp. sman
Echo cd % bak_date %> ftp. sman
Echo mput % bak_tmpfile % \ *> ftp. sman
Echo bye> ftp. sman

FTP-S: ftp. sman-I> % bak_logpath‑log-‑bak_date‑.txt
Del ftp. sman/Q
Rem xcopy % bak_tmpfile % * c: \ Temp/y
Del % bak_tmpfile % *. */Q/s
Rd % bak_tmpfile %/Q
Echo -------- uploaded [% time %/% bak_timestart %]> % bak_logpath1_log-baibak_date0000.txt

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.