实现windows自动从linux上下载、上传文件的批处理

第一、需要的工具
(1)ftpcmd.exe
(2)plink.exe

第二、实现download
download.bat
@echo off

setlocal

if "%BMP_HOST%"=="" goto exit
if "%BMP_USER%"=="" goto exit
if "%BMP_PASSWORD%"=="" goto exit
if "%1"=="" goto exit
if "%2"=="" goto exit
if "%3"=="" goto exit

set DST=%3
if not "%4"=="" set DST=%4

ftpcmd get --passive --image true --host %BMP_HOST% --username %BMP_USER% --password %BMP_PASSWORD% --remote "%1" --local "%2" --src "%3" --dst "%DST%"

del /q "%~dp0\*.url"

endlocal

exit

第三、实现upload
@echo off

if "%BMP_HOST%"=="" goto exit
if "%BMP_USER%"=="" goto exit
if "%BMP_PASSWORD%"=="" goto exit
if "%1"=="" goto exit
if "%2"=="" goto exit
if "%3"=="" goto exit

ftpcmd put --passive --image true --host %BMP_HOST% --username %BMP_USER% --password %BMP_PASSWORD% --remote "%1" --local "%2" --src "%3" --dst "%3"

del /q "%~dp0\*.url"

exit

猜你喜欢

转载自511039003.iteye.com/blog/2072773