Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to backup files and upload them to bat of FTP server

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to backup files and upload to the FTP server bat, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor with you to understand.

Back up files regularly and upload them to the backup server by FTP

The code is as follows:

@ echo off

Color 0f

Title backs up files regularly and uploads them to the backup server by FTP

Folder to be backed up by rem

Echo:

Set / p bak_webFile= Please drag the file (folder) to be uploaded here

Rem current date (format YYYYMMDD)

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

Rem ftp information

Set bak_ftpServer=202.96.189.52

Set bak_ftpUserName=Wingl83

Set bak_ftpUserPass=l7l2O6OO

Echo:

Echo:

Echo: start uploading

Rem generates ftp command file

Echo open bak_ftpServer% > ftp.up

Echo bak_ftpUserName% > > ftp.up

Echo bak_ftpUserPass% > > ftp.up

Echo bin > > ftp.up

Echo mput% bak_webFile%\ * > ftp.up

Echo bye > > ftp.up

FTP-s:ftp.up-I > > bak_logPath%log-%bak_date%.txt

Del ftp.up / q

Del log-%bak_date%.txt / q

Echo:

Echo:

Echo: upload completed

Back up files regularly and upload them to the backup server by FTP

The code is as follows:

Rem backs up files regularly and uploads them to the backup server by FTP

Folder to be backed up by rem

Set bak_webFile=F:\ backup\

Rem temporary folder

Set bak_tmpFile=C:\ ~ UpTemp\

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=202.96.189.52

Set bak_ftpUserName=Wingl83

Set bak_ftpUserPass=l7l2O6OO

Set bak_timeStart=%time%

Md bak_tmpFile%

Md bak_logPath%

Echo-start compressing [% bak_timeStart%] >% bak_logPath%log-%bak_date%.txt

"C:\ Program Files\ WinRAR\ Rar.exe" a-ag+%bak_bakFile%% bak_tmpFile%% bak_webFile%

Echo-Compression completed, start uploading [% time%/%bak_timeStart%] > >% bak_logPath%log-%bak_date%.txt

Rem generates ftp command file

Echo open bak_ftpServer% > ftp.up

Echo bak_ftpUserName% > > ftp.up

Echo bak_ftpUserPass% > > ftp.up

Echo bin > > ftp.up

Echo mkdir bak_date% > > ftp.up

Echo cd bak_date% > > ftp.up

Echo mput% bak_tmpFile%\ * > ftp.up

Echo bye > > ftp.up

FTP-s:ftp.up-I > > bak_logPath%log-%bak_date%.txt

Del ftp.up / q

Rem Xcopy% bak_tmpFile%* C:\ Temp / y

Del% bak_tmpFile%*.* / Q / s

Rd% bak_tmpFile% / Q

Echo-upload completed [% time%/%bak_timeStart%] > >% bak_logPath%log-%bak_date%.txt

Thank you for reading this article carefully. I hope the article "how to back up files and upload them to the bat of FTP server" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report