def downLoadFile(sftp, remotePath, localPath):
    for fileattr in sftp.listdir_attr(remotePath):
        if stat.S_ISDIR(fileattr.st_mode):
            pass
How to check a remote path is a file or a directory?