Windows与Linux之间文件传输

获取WinSCP

windows上装上Winscp程序,使用这个程序通过sftp协议把本地的文件传输到linux服务器上。
在这里插入图片描述

下载地址

编写脚本

# WinSCP.exe /console /script=sample.txt
# Automatically answer all prompts negatively not to stall
# the script on errors
# option echo  on|off
option echo off
# option batch on|off|abort|continue
option batch on
# option confirm  on|off 
option confirm off
# option transfer  binary|ascii|automatic 
# option synchdelete  on|off
# option exclude clear | [;...]
# option include clear | [;...]
# open [ sftp|ftp|scp:// ][ [ :password ] @ ] [ : ]
# open user:password@example.com
# Connect   
open  scp://root:name@192.168.1.1:22
#open [scp:// ][ [ :password ] @ ] [ : ]
# Change remote directory
# cd /home/user              #远程工作目录
cd /tmp
# Change local directory
# set to Self's working dir 
#lcd D:\XXXXXX.bin                   #本地工作目录
put C:\Users\Administrator\Desktop\XXXXXXXXX.bin
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
# get examplefile.txt d:\
# option synchdelete  on|off
option synchdelete off       #是否同步删除  
# option include clear | [;...]
# option include /2008-*-*/;/2009-*-*/;/2010-*-*/;/2011-*-*/;/2012-*-*/;/2013-*-*/
# synchronize local|remote|both [ [ ] ] 
# 传输方式:Local为远程至本地,remote为本地到远程,both双向传输
#使用关键字synchronize的话,将会同步本地目录下的文件至远程目录
#synchronize remote
remote
# Disconnect
close
# Exit WinSCP
exit

说明:

我这里需要传送的文件只有一个二进制文件,所以后面不需要同步,如果需要操作整个目录的文件可以用synchronize remote。

执行脚本

在Windows系统中运行cmd,通过WinSCP.exe执行这个脚本即可。
在这里插入图片描述

https://blog.csdn.net/shufac/article/details/51966276

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值