scp with paramiko

Alexander Gattin xrgtn at yandex.ru
Tue Sep 14 23:42:52 CEST 2010


Hello,

On Wed, Sep 01, 2010 at 09:56:18AM -0700, cerr
wrote:
> I want to download a file from a client using
> paramiko. I found plenty of ressources using
> google on how to send a file but none  that
> would describe how to download files from a
> client.

Download files from remote to local?
Get sftp object as usual, then e.g.:

for f in sftp.listdir(rdir):
    lf = os.path.join(opts.tmpdir, f)
    sftp.get(rdir + "/" + f, lf)

sftp.get() uses path + "/" + basename instead
of os.path.join() because the latter uses local
pathname conventions which may or may not be
appropriate for remote system.

-- 
With best regards,
xrgtn



More information about the Python-list mailing list