S
S
shell_guy2021-11-08 18:36:26
Python
shell_guy, 2021-11-08 18:36:26

Why doesn't the python script for sftp file transfer work?

Task: there is win7 and linux host
The connection to the linux server is established but nothing further happens.
How can I make it take a folder and recursively copy it to a remote Linux host?

import paramiko

host = "192.168.2.1"                    
port = 22
transport = paramiko.Transport((host, port))

password = "Pass"                
username = "root"                
transport.connect(username = username, password = password)
sftp=ssh.open_sftp()
sftp = paramiko.SFTPClient.from_transport(transport)


path = '/share/MD0_DATA/MSSQL' + sys.argv[1]    
localpath = sys.argv[1]
sftp.put(localpath, path)

sftp.close()
transport.close()
print ('Upload done!')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MaxKozlov, 2021-11-09
@MaxKozlov

And in what place of docks it is written that it is able to put the whole folder?
https://docs.paramiko.org/en/stable/api/sftp.html#...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question