synchronizing codes between Windows and Linux

When we overhaul some codes in source insight,we wanna modify them to understand their meaning.If codes are run in Linux(e.g.,Ubuntu),we need to upload or synchronize them to remote server by Winscp,a visual tools,which is cumbersome and low efficient.Therefore,I develop a python program with pscp command from Winscp,which partly refers to the blog

synchronize codes

We can use command as follow to upload codes from Windows to Linux:

pscp Windows_local_path username@Linux_server'IP:/remote_path

it is similar to the command SCP for transferring files between Linux.

python program is shown as follow:

import os
srcpath = os.path.join(os.getcwd(),r"sda9.txt")
dstpath = r"/home/f2fs/test/strace"
cmd = "pscp -l f2fs -pw root " + srcpath + " f2fs@192.168.40.146:" + dstpath
os.system(cmd)
print("success")

在这里插入图片描述

Appendix

C:\Users\Administrator\Desktop>pscp
PuTTY Secure Copy client
Release 0.70
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls [user@]host:filespec
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -p        preserve file attributes
  -q        quiet, don't show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for user authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -hostkey aa:bb:cc:...
            manually specify a host key (may be repeated)
  -batch    disable all interactive prompts
  -proxycmd command
            use 'command' as local proxy
  -unsafe   allow server-side wildcards (DANGEROUS)
  -sftp     force use of SFTP protocol
  -scp      force use of SCP protocol
  -sshlog file
  -sshrawlog file
            log protocol details to a file
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值