SFTP 定时任务下载

 

1、上传

winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "put D:\1.txt  /tmp/" "exit" /log=log_file.txt 

 

@ECHO OFF 
cd C:\Program Files (x86)\WinSCP
winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "get /tmp D:\test\app\" "exit" /log=log_file.txt

 

 

 

2、下载

 

winscp.exe /console /command "option batch continue" "option confirm off" "open sftp://bypass:abc123!@192.168.150.129:22" "option transfer binary" "get /tmp D:\test\app\" "exit" /log=log_file.txt

 

Linux

#! /bin/sh

echo "Starting to sftp..."

lftp -u root,abc123! sftp://192.168.204.130 << EOF
cd /tmp
mget *.*
bye
EOF

echo "done"

 

 

参考文章:

https://yq.aliyun.com/articles/437616

lftp登录sftp 自动下载某一目录下的所有文件

https://www.cnblogs.com/binw/p/4065607.html

WinSCP自动执行脚本

https://blog.csdn.net/GYGuo95/article/details/80041139

windows下 命令行+winscp 实现与linux的远程文件传输

windows下定时利用bat脚本实现ftp上传和下载

https://www.cnblogs.com/caizhao/p/8119888.html

posted @ 2019-06-11 13:21  Bypass  阅读(2254)  评论(0编辑  收藏  举报