Jun-18-2019, 09:22 AM
(This post was last modified: Jun-18-2019, 09:22 AM by Pedroski55.)
I managed to get ssh working for me.
Now I want to log in, cd, get all the files in a directory, download them to /home/pedro/essays/ delete the files on the server and logout
The bit I'm not sure of: how to tell sftp where to download the files to??
Will this work?
Also, what should go in hostname? The ip number or www.mywebpage.com?
Now I want to log in, cd, get all the files in a directory, download them to /home/pedro/essays/ delete the files on the server and logout
The bit I'm not sure of: how to tell sftp where to download the files to??
Will this work?
Quote:remote_file = '*.* /home/pedro/essays/'
Also, what should go in hostname? The ip number or www.mywebpage.com?
import pysftp hostname = '123.456.123.456' me = 'mycPanelusername' secret = 'mypassword' remote_file = '*.* /home/pedro/essays/' with pysftp.Connection('hostname', username='me', password='secret') as sftp: with sftp.cd('/public_html/php/uploads/'): # temporarily chdir to /public_html/php/uploads/ #sftp.put('/pycode/filename') # upload file to allcode/pycode on remote sftp.get('remote_file') # get remote file(s)