Answers for "how to copy file from local to sftp using python"

0

how to copy file from local to sftp using python

import paramiko
import os

paramiko.util.log_to_file('logfile.log')

host = "101.102.103.104"
port = 22
transport = paramiko.Transport((host, port))
password = "pass"
username = "user"

sftp = paramiko.SFTPClient.from_transport(transport)

filepath = '~/remote/file'
localpath = '~/local/file'
sftp.get(filepath, localpath)

sftp.close()
transport.close()
Posted by: Guest on April-14-2021

Code answers related to "how to copy file from local to sftp using python"

Python Answers by Framework

Browse Popular Code Answers by Language