Recursive directory download with Paramiko?

from stat import S_ISDIR

def isdir(path):
  try:
    return S_ISDIR(sftp.stat(path).st_mode)
  except IOError:
    #Path does not exist, so by definition not a directory
    return False

…assuming sftp is an open Paramiko SFTP connection.

Leave a Comment