将本地windows文件夹备份到远程FTP脚本
程序员文章站
2022-04-17 18:32:44
...
将本地windows文件夹备份到远程FTP脚本并删除远程
脚本:
@echo off
echo.
cd E:\backup\
set time_hh=%time:~0,2%
if /i %time_hh% LSS 10 (set time_hh=0%time:~1,1%)
set filename=%date:~,4%%date:~5,2%%date:~8,2%_%time_hh%%time:~3,2%%time:~6,2%
set /a deldata=filename-7
Rar.exe a -m5 -r Mybackup-%filename%.rar @backup.lst.txt
mkdir local_backup
echo open 192.168.11.250 >ftp.txt
echo ftpusserxxx>>ftp.txt
echo xxxxx>>ftp.txt
echo binary>>ftp.txt
echo lcd E:\backup>>ftp.txt
echo prompt>>ftp.txt
echo mput Mybackup-%filename%.rar >>ftp.txt
echo mdelete Mybackup-%deldata%*.rar >>ftp.txt
echo close>>ftp.txt
echo bye>>ftp.txt
ftp -s:ftp.txt
move E:\backup\Mybackup-%filename%.rar E:\backup\local_backup
echo.
我将Rar执行文件放到同一目录
设置定时调用bat脚本
上一篇: uva 11729