首页 > Windows开发 > 详细

将Windows下的文件同步到Linux下

时间:2018-10-12 15:25:07      阅读:210      评论:0      收藏:0      [点我收藏+]

 

 

需求:把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下的查看结果:

技术分享图片

 

将Windows下的文件同步到Linux下

原文:https://www.cnblogs.com/linlianhuan/p/9778270.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!