Questions tagged [pysftp]

pysftp is a thin wrapper over paramiko's SFTPClient.

pysftp is a thin wrapper over 's SFTPClient.

372 questions
2
votes
2 answers

Do not download empty folders while downloading from SFTP server using Python

I got a code to download files recursively in Python on this site. This code also downloads empty directories on server also. Please help me to modify this code so that it does not download empty directories from the server. Code I have (based on…
udit kanotra
  • 328
  • 1
  • 3
  • 17
2
votes
1 answer

Download files from SFTP server that are older than 5 days using Python

I got a Python script on this site that downloads files from the directory from SFTP server. Now I need help to modify this code so that it only downloads the files that older than 5 days from the day the code is used. Code to download files (based…
udit kanotra
  • 328
  • 1
  • 3
  • 17
2
votes
2 answers

"IOError: size mismatch in get!" when retrieving files via SFTP

I have a script which I use to retrieve specific files via SFTP on a regular basis. On occasion, the script will error out with the following output: Traceback (most recent call last): File "ETL.py", line 304, in
joshv2
  • 80
  • 2
  • 11
2
votes
2 answers

Append to existing file on SFTP server via pysftp

I have one file named Account.txt in SFTP server, and I'm trying to appending a line to this file. This is my effort: from io import StringIO from pysftp import Connection, CnOpts cnopts = CnOpts() cnopts.hostkeys = None with…
Han Van Pham
  • 462
  • 1
  • 6
  • 24
2
votes
2 answers

Python pysftp.put raises "No such file" exception although file is uploaded

I am using pysftp to connect to a server and upload a file. cnopts = pysftp.CnOpts() cnopts.hostkeys = None self.sftp = pysftp.Connection(host=self.serverConnectionAuth['host'], port=self.serverConnectionAuth['port'], …
Amir Zare
  • 453
  • 1
  • 4
  • 15
2
votes
1 answer

Unable to download file with pysftp get

I am able to connect the sftp with pysftp successfully, but getting error while downloading file as FileNotFoundError: [Errno 2] No such file. I also observed that the file is just creating at local path adding '?' along with extension. Below are…
learner
  • 119
  • 1
  • 2
  • 12
2
votes
2 answers

Why chdir in pysftp library doesn't effect on execute in pysftp library?

I uses pysftp (it is wrapper of paramiko). import pysftp cnopts = pysftp.CnOpts() cnopts.hostkeys = None sftp=pysftp.Connection(host='hostname',username="root",password="pass",cnopts=cnopts) The script in /home/alex_test and I want to execute the…
user9343376
2
votes
1 answer

Connecting to an SFTP server using pysftp and Python 3 with just the server fingerprint

I'm in kind of a bizarre situation where I need to connect to an SFTP server for the first time but I can't seem to find a way to get access to the known host entry for the server.I can connect fine if I say: import pysftp cnopts =…
Bob Wakefield
  • 3,739
  • 4
  • 20
  • 30
2
votes
2 answers

how to give sftp proxy command in python script using paramiko?

I want to use proxy command in python using paramiko. proxy command: sftp -o "ProxyCommand /usr/bin/nc --proxy proxy.somegateway.com:8080 %h %p" but when I use this directly, I am able to connect sftp server. but if I want to use this proxy command…
user4941703
2
votes
1 answer

Using python pysftp package, getting a "SSHException: Bad host key from server" error

I am running Python 3 with the pysftp package, version 0.2.9. The following code I have is here. I am loading the hostkey correctly as shown by the line cnopts.hostkeys.keys(). import pysftp key_file_test =…
Alex F
  • 2,086
  • 4
  • 29
  • 67
2
votes
4 answers

Is it possible to Remove Directory with some contents using pysftp module?

I am creating a backup script using pysftp module. I am able to upload and download files. When i am trying to Delete a directory with some contents i got an exception. This is what i tried con =…
Fuji Komalan
  • 1,979
  • 16
  • 25
2
votes
1 answer

Using Python's pysftp, how do you verify a host key?

I am using Python 2.7 pysftp package to connect to an SFTP server. import pysftp DOWNLOAD = { "USERNAME": "username", "PASSWORD": "password" } FTP_SITE = 'sftp.mysite.com' srv = pysftp.Connection(host=FTP_SITE, username=DOWNLOAD['USERNAME'], …
Alex F
  • 2,086
  • 4
  • 29
  • 67
2
votes
1 answer

How to copy a specific format file from sftp to local using Python

import paramiko import os paramiko.util.log_to_file('logfile.log') host = "100.10.89.23" port = 22 transport = paramiko.Transport((host, port)) password = "pass" username = "user" transport.connect(username = username, password = password) sftp =…
Aquil Abbas
  • 167
  • 2
  • 11
2
votes
3 answers

Recursive download with pysftp

I'm trying to fetch from SFTP with the following structure: main_dir/ dir1/ file1 dir2/ file2 I tried to achieve this with commands below: sftp.get_r(main_path + dirpath, local_path) or sftp.get_d(main_path + dirpath, local_path) The local…
Crabar
  • 1,829
  • 1
  • 14
  • 26
2
votes
2 answers

Error in folder names when using Pysftp to transfer files from Windows

I am using Pysftp to transfer files from a Windows server to a Buffalo Terastation. I would like to be able to tell it to transfer all files in a folder using the PUT_R command but when I run my code the files are transferred oddly. My…
GreyHippo
  • 263
  • 1
  • 2
  • 14