需求:把Windows下的某些文件自动传送到Linux指定目录下

实现:

1. Windows下安装 WinSCP工具,并把Liunx服务器信息保存

 

2. 编写脚本,实现双击工具就把Windows下的文件上传到Linux下,

========================== copyFile.txt =====================================START===========

option echo off
option batch on
option confirm off

## linux服务器的信息,需要先在Windows下安装 WinSCP 工具,并保存好该服务器的信息(手动登录一次就可以保存)
open scp://root:password@192.168.1.101:22

#open [scp:// ][ [ user:password ] @ ] [ IP:Port ]

 

## 上传到Linux上的文件目录

cd /data/linlh/tmp/

## Windows下要上传到Liunx服务器的文件
put E:\bonree\SVN同步程序wc\SDK_Web_ChartReport\SDK_Web_ChartReport.zip

option synchdelete off
close
exit

========================== copyFile.txt ===================================== END ===========

 

=========================== autoSendFile.bat ===============================START==========

:: windows下的WinSCP安装目录
cd /d E:\linlh\SofeWare\winscp428\Bonree\WinSCP

:: 修改Windows下的要上传文件的文件脚本目录
WinSCP.exe /console /script="C:\Users\Administrator\Evernote\Databases\Attachments\copyFile.txt"

=========================== autoSendFile.bat ===============================END==========

 

3. 运行脚本,双击 autoSendFile.bat 工具

Windows下的运行结果:

 

 Linux下的查看结果:

 

posted on 2018-10-12 15:14  咖啡猫来啦  阅读(717)  评论(0编辑  收藏  举报