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

Method deleteFiles

pager_lib/smb/SMBConnection.py:414–442  ·  view source on GitHub ↗

Delete one or more regular files. It supports the use of wildcards in file names, allowing for deletion of multiple files in a single request. If delete_matching_folders is True, immediate sub-folders that match the path_file_pattern will be deleted recursively. :param str

(self, service_name, path_file_pattern, delete_matching_folders = False, timeout = 30)

Source from the content-addressed store, hash-verified

412 return results[0]
413
414 def deleteFiles(self, service_name, path_file_pattern, delete_matching_folders = False, timeout = 30):
415 """
416 Delete one or more regular files. It supports the use of wildcards in file names, allowing for deletion of multiple files in a single request.
417
418 If delete_matching_folders is True, immediate sub-folders that match the path_file_pattern will be deleted recursively.
419
420 :param string/unicode service_name: Contains the name of the shared folder.
421 :param string/unicode path_file_pattern: The pathname of the file(s) to be deleted, relative to the service_name.
422 Wildcards may be used in th filename component of the path.
423 If your path/filename contains non-English characters, you must pass in an unicode string.
424 :return: None
425 """
426 if not self.sock:
427 raise NotConnectedError('Not connected to server')
428
429 def cb(r):
430 self.is_busy = False
431
432 def eb(failure):
433 self.is_busy = False
434 raise failure
435
436 self.is_busy = True
437 try:
438 self._deleteFiles(service_name, path_file_pattern, delete_matching_folders, cb, eb, timeout = timeout)
439 while self.is_busy:
440 self._pollForNetBIOSPacket(timeout)
441 finally:
442 self.is_busy = False
443
444 def resetFileAttributes(self, service_name, path_file_pattern, file_attributes = ATTR_NORMAL, timeout = 30):
445 """

Callers

nothing calls this directly

Calls 2

_pollForNetBIOSPacketMethod · 0.95
NotConnectedErrorClass · 0.70

Tested by

no test coverage detected