windows----bat方式实现ftp推送
在windows上实现ftp的数据推送
可以分成两个文件,一个bat,一个txt。
bat直接调用ftp命令并用-s参数指定配置文件
@echo off ftp -s:C:\Users\Administrator\Desktop\scripts\auto_station\auto_station_all.txt
txt文件配置的是ftp的操作命令
open 10.12.13.20 ftp_user 123456 prompt off lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\Hour cd /qxgcy/devices/Hour mput * close open 10.12.13.20 ftp_user 123456 lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\Minute cd /qxgcy/devices/Minute mput * close open 10.12.13.20 ftp_user 123456 lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\状态 cd /qxgcy/devices/status mput * prompt on bye quit
也可以把这两步都写在同一个bat下
@echo off set date1=%Date:~0,4%%Date:~5,2% #bat输出时间的方式,其中Date是命令,%Date:~0,4%代表指针向右偏移0位,同时向右抓取4个字符。 set date2=%Date:~0,4%%Date:~5,2%%Date:~8,2% (echo open 10.12.13.20 echo ftp_user echo 123456 echo prompt off echo lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\Hour echo cd /qxgcy/devices/Hour echo mput *%date1%*.txt echo lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\Minute echo cd /qxgcy/devices/Minute echo mput *%date2%*.txt echo lcd D:\smo\dataset\广东\59288\AWS\新型自动站\设备\状态 echo cd /qxgcy/devices/status echo mput *%date2%*.txt echo prompt on echo quit) > C:\Users\Administrator\Desktop\scripts\auto_station\auto_station_add.txt ftp -s:C:\Users\Administrator\Desktop\scripts\auto_station\auto_station_add.txt