Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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()
Comment

PREVIOUS NEXT
Code Example
Python :: modify a list with for loop and range function in python 
Python :: calculate term frequency python 
Python :: python crop string 
Python :: python mod function 
Python :: python extract substring 
Python :: os path splitext 
Python :: destroy label tkinter 
Python :: python delete all occurrences from list 
Python :: sphere volume formula 
Python :: get file size python 
Python :: to str python 
Python :: check if list is empty python 
Python :: how to swap two variables without using third variable python 
Python :: gzip folder python 
Python :: from django.db import models 
Python :: matp[lotlib max y value 
Python :: Invalid password format or unknown hashing algorithm. 
Python :: tkinter responsive gui 
Python :: scrollbar tkinter 
Python :: How to track hands python opencv/mediapipe 
Python :: iterate through directories in python 
Python :: python switch statement 
Python :: lambda function in python 
Python :: is python object oriented language 
Python :: make a label using tkinter in python 
Python :: Python DateTime Timedelta Class Syntax 
Python :: plot multiindex columns pandas 
Python :: tkinter change button state 
Python :: python find string in list 
Python :: numpy where 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =