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

Method rename

pager_lib/smb/SMBProtocol.py:360–376  ·  view source on GitHub ↗

Rename a file or folder at *old_path* to *new_path* shared at *service_name*. Note that this method cannot be used to rename file/folder across different shared folders *old_path* and *new_path* are string/unicode referring to the old and new path of the renamed resources (relative

(self, service_name, old_path, new_path)

Source from the content-addressed store, hash-verified

358 return d
359
360 def rename(self, service_name, old_path, new_path):
361 """
362 Rename a file or folder at *old_path* to *new_path* shared at *service_name*. Note that this method cannot be used to rename file/folder across different shared folders
363
364 *old_path* and *new_path* are string/unicode referring to the old and new path of the renamed resources (relative to) the shared folder.
365 If the path contains non-English characters, an unicode string must be used to pass in the path.
366
367 :param string/unicode service_name: Contains the name of the shared folder.
368 :param integer/float timeout: Number of seconds that pysmb will wait before raising *SMBTimeout* via the returned *Deferred* instance's *errback* method.
369 :return: A *twisted.internet.defer.Deferred* instance. The callback function will be called with a 2-element tuple of ( *old_path*, *new_path* ).
370 """
371 if not self.instance:
372 raise NotConnectedError('Not connected to server')
373
374 d = defer.Deferred()
375 self.instance._rename(service_name, old_path, new_path, d.callback, d.errback)
376 return d
377
378 def echo(self, data, timeout = 10):
379 """

Callers

nothing calls this directly

Calls 1

NotConnectedErrorClass · 0.70

Tested by

no test coverage detected