将Windows下的文件同步到Linux下
?
?
需求:把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下的查看結果:
?
轉載于:https://www.cnblogs.com/linlianhuan/p/9778270.html
總結
以上是生活随笔為你收集整理的将Windows下的文件同步到Linux下的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【洛谷 P2303】 [SDOi2012
- 下一篇: SpringBoot------Serv