title: Recursive directory download with Paramiko?
body: <p>I want to download a directory with unknown contents recursively via SSH and have been trying Paramiko. I have seen several examples how to upload directories but none that covers recursive download.  </p>
  
  <p>I can list all items in a directory but haven't been able to find a way of knowing if the item is a file (to download) or a directory (to call recursively).</p>
  
  <pre><code>transport = paramiko.Transport((MY_IP, 22))
  transport.connect(username=MY_NAME, password=MY_PASS)
  sftp = paramiko.SFTPClient.from_transport(transport)
  
  file_list = sftp.listdir(path='/home/MY_HOME_DIR')
      for item in file_list:
          # Here is an item name... but is it a file or directory?
          print(item)
  sftp.close()
  transport.close()
  </code></pre>
  
  <p>So how do I know if an item is a file or if it is a directory?</p>