def _remove_dir(self, path): for root, dirs, files in self.walk(path, topdown=False): for fname in files: path = posixpath.join(root, fname) with ignore_file_not_found(): self._remove_file(path) for dname in dirs: path = posixpath.join(root, dname) with ignore_file_not_found(): self._sftp.rmdir(dname) with ignore_file_not_found(): self._sftp.rmdir(path)
def st_mode(self, path): self._sftp_connect() with ignore_file_not_found(): return self._sftp.stat(path).st_mode return 0
def getsize(self, path): with ignore_file_not_found(): return self.sftp.lstat(path).st_size return 0
def _remove_file(self, path): with ignore_file_not_found(): self._sftp.remove(path)
def st_mode(self, path): with ignore_file_not_found(): return self.sftp.lstat(path).st_mode return 0