MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / listPath

Method listPath

pager_lib/smb/SMBProtocol.py:180–207  ·  view source on GitHub ↗

Retrieve a directory listing of files/folders at *path* For simplicity, pysmb defines a "normal" file as a file entry that is not read-only, not hidden, not system, not archive and not a directory. It ignores other attributes like compression, indexed, sparse, temporary and

(self, service_name, path,
                 search = SMB_FILE_ATTRIBUTE_READONLY | SMB_FILE_ATTRIBUTE_HIDDEN | SMB_FILE_ATTRIBUTE_SYSTEM | SMB_FILE_ATTRIBUTE_DIRECTORY | SMB_FILE_ATTRIBUTE_ARCHIVE | SMB_FILE_ATTRIBUTE_INCL_NORMAL,
                 pattern = '*', timeout = 30)

Source from the content-addressed store, hash-verified

178 return d
179
180 def listPath(self, service_name, path,
181 search = SMB_FILE_ATTRIBUTE_READONLY | SMB_FILE_ATTRIBUTE_HIDDEN | SMB_FILE_ATTRIBUTE_SYSTEM | SMB_FILE_ATTRIBUTE_DIRECTORY | SMB_FILE_ATTRIBUTE_ARCHIVE | SMB_FILE_ATTRIBUTE_INCL_NORMAL,
182 pattern = '*', timeout = 30):
183 """
184 Retrieve a directory listing of files/folders at *path*
185
186 For simplicity, pysmb defines a "normal" file as a file entry that is not read-only, not hidden, not system, not archive and not a directory.
187 It ignores other attributes like compression, indexed, sparse, temporary and encryption.
188
189 Note that the default search parameter will query for all read-only (SMB_FILE_ATTRIBUTE_READONLY), hidden (SMB_FILE_ATTRIBUTE_HIDDEN),
190 system (SMB_FILE_ATTRIBUTE_SYSTEM), archive (SMB_FILE_ATTRIBUTE_ARCHIVE), normal (SMB_FILE_ATTRIBUTE_INCL_NORMAL) files
191 and directories (SMB_FILE_ATTRIBUTE_DIRECTORY).
192 If you do not need to include "normal" files in the result, define your own search parameter without the SMB_FILE_ATTRIBUTE_INCL_NORMAL constant.
193 SMB_FILE_ATTRIBUTE_NORMAL should be used by itself and not be used with other bit constants.
194
195 :param string/unicode service_name: the name of the shared folder for the *path*
196 :param string/unicode path: path relative to the *service_name* where we are interested to learn about its files/sub-folders.
197 :param integer search: integer value made up from a bitwise-OR of *SMB_FILE_ATTRIBUTE_xxx* bits (see smb_constants.py).
198 :param string/unicode pattern: the filter to apply to the results before returning to the client.
199 :param integer/float timeout: Number of seconds that pysmb will wait before raising *SMBTimeout* via the returned *Deferred* instance's *errback* method.
200 :return: A *twisted.internet.defer.Deferred* instance. The callback function will be called with a list of :doc:`smb.base.SharedFile<smb_SharedFile>` instances.
201 """
202 if not self.instance:
203 raise NotConnectedError('Not connected to server')
204
205 d = defer.Deferred()
206 self.instance._listPath(service_name, path, d.callback, d.errback, search = search, pattern = pattern, timeout = timeout)
207 return d
208
209 def listSnapshots(self, service_name, path, timeout = 30):
210 """

Callers

nothing calls this directly

Calls 1

NotConnectedErrorClass · 0.70

Tested by

no test coverage detected