Logo Search packages:      
Sourcecode: paramiko version File versions  Download package

def paramiko::sftp_client::SFTPClient::listdir_attr (   self,
  path = '.' 
)

Return a list containing L{SFTPAttributes} objects corresponding to
files in the given C{path}.  The list is in arbitrary order.  It does
not include the special entries C{'.'} and C{'..'} even if they are
present in the folder.

@param path: path to list (defaults to C{'.'})
@type path: str
@return: list of attributes
@rtype: list of L{SFTPAttributes}

@since: 1.2

Definition at line 118 of file sftp_client.py.

00118                                     :
        """
        Return a list containing L{SFTPAttributes} objects corresponding to
        files in the given C{path}.  The list is in arbitrary order.  It does
        not include the special entries C{'.'} and C{'..'} even if they are
        present in the folder.

        @param path: path to list (defaults to C{'.'})
        @type path: str
        @return: list of attributes
        @rtype: list of L{SFTPAttributes}
        
        @since: 1.2
        """
        path = self._adjust_cwd(path)
        t, msg = self._request(CMD_OPENDIR, path)
        if t != CMD_HANDLE:
            raise SFTPError('Expected handle')
        handle = msg.get_string()
        filelist = []
        while True:
            try:
                t, msg = self._request(CMD_READDIR, handle)
            except EOFError, e:
                # done with handle
                break
            if t != CMD_NAME:
                raise SFTPError('Expected name response')
            count = msg.get_int()
            for i in range(count):
                filename = _to_unicode(msg.get_string())
                longname = _to_unicode(msg.get_string())
                attr = SFTPAttributes._from_msg(msg, filename)
                if (filename != '.') and (filename != '..'):
                    filelist.append(attr)
        self._request(CMD_CLOSE, handle)
        return filelist

    def file(self, filename, mode='r', bufsize=-1):


Generated by  Doxygen 1.6.0   Back to index