Пример #1
0
    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)
Пример #2
0
    def st_mode(self, path):
        self._sftp_connect()

        with ignore_file_not_found():
            return self._sftp.stat(path).st_mode

        return 0
Пример #3
0
    def getsize(self, path):
        with ignore_file_not_found():
            return self.sftp.lstat(path).st_size

        return 0
Пример #4
0
 def _remove_file(self, path):
     with ignore_file_not_found():
         self._sftp.remove(path)
Пример #5
0
    def st_mode(self, path):
        with ignore_file_not_found():
            return self.sftp.lstat(path).st_mode

        return 0