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 [email protected]_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[email protected]:" + dstpath
os.system(cmd)
print("success")
Appendix
C:\Users\Administrator\Desktop>pscp
PuTTY Secure Copy client
Release 0.70
Usage: pscp [options] [[email protected]]host:source target
pscp [options] source [source...] [[email protected]]host:target
pscp [options] -ls [[email protected]]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