windows bat ftp多文件上传

2017-11-27 19:10:24来源:CSDN作者:jucks2611人点击

分享

windows bat命令实现ftp多文件上传

文件名为前一天日期格式,日志为当天日期格式。由于项目中对方ftp服务器防火墙关设置原因,导致java通过代码无法上传到ftp服务器,沟通下来,对方不能修改防火墙,但是通过cmd命令可以正常上传和下载文件。没有办法,研究一下午通过bat命令上传每天统计的文件。

文件名:ftp-put.bat

@echo offrem ////////////////////////////////////////////rem // gilbertrem // Files Upload Scriptsrem // 2017-11-27rem ////////////////////////////////////////////rem 计算指定天数之前的日期  set DaysAgo=1rem time format is yyyy-mm-ddcall :DateToDays %date:~0,4% %date:~5,2% %date:~8,2% PassDaysset /a PassDays-=%DaysAgo%call :DaysToDate %PassDays% DstYear DstMonth DstDayset DstDate=%DstYear%%DstMonth%%DstDay%echo %DaysAgo%days ago time is %DstDate%set LASSDATE=%DstDate%set quality_filename=D.IBD.CUSTOMER_SERVICE_QUALITY.set sshw_filename=D.IBD.CUSTOMER_SERVICE_MANHOUR.set logname=ftp-set nowdate=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%echo  %LASSDATE%echo open 192.168.1.1> %logname%%nowdate%.txtecho iphone>> %logname%%nowdate%.txtecho iphone>> %logname%%nowdate%.txtecho bin >> %logname%%nowdate%.txtecho cd /ftpdata/receive/zhrl/IBD/ >> %logname%%nowdate%.txtecho lcd E:/app/Tomcat6.0_zhrl_8081/webapps/zhrl_interface/zjFile >> %logname%%nowdate%.txtecho put %quality_filename%%LASSDATE%.00.txt >> %logname%%nowdate%.txtecho lcd E:/app/Tomcat6.0_zhrl_8081/webapps/zhrl_interface/sshwFile >> %logname%%nowdate%.txtecho put %sshw_filename%%LASSDATE%.00.txt >> %logname%%nowdate%.txtecho bye >> %logname%%nowdate%.txtftp -s:%logname%%nowdate%.txtgoto :eof:DateToDays %yy% %mm% %dd% dayssetlocal ENABLEEXTENSIONSset yy=%1&set mm=%2&set dd=%3if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)set /a dd=100%dd%%%100,mm=100%mm%%%100set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633endlocal&set %4=%j%&goto :EOF:DaysToDate %days% yy mm ddsetlocal ENABLEEXTENSIONSset /a a=%1+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=aset /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)endlocal&set %2=%yy%&set %3=%mm%&set %4=%dd%&goto :EOF

备注:192.168.1.1为上传ftp ip,iphone为用户名和密码
注意,网上流传的取前一天时间,不能放在ftp上传的前面,不然会导致后面ftp上传命令无效。

相关文章

    无相关信息

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台