def chmod(self, mode): """ Change the mode (permissions) of this file. The permissions are unix-style and identical to those used by python's C{os.chmod} function. @param mode: new permissions @type mode: int """ self.sftp._log(DEBUG, 'chmod(%s, %r)' % (hexlify(self.handle), mode)) attr = SFTPAttributes() attr.st_mode = mode self.sftp._request(CMD_FSETSTAT, self.handle, attr)
def chmod(self, path, mode): """ Change the mode (permissions) of a file. The permissions are unix-style and identical to those used by python's C{os.chmod} function. @param path: path of the file to change the permissions of @type path: str @param mode: new permissions @type mode: int """ path = self._adjust_cwd(path) self._log(DEBUG, 'chmod(%r, %r)' % (path, mode)) attr = SFTPAttributes() attr.st_mode = mode self._request(CMD_SETSTAT, path, attr)
def mkdir(self, path, mode=0777): """ Create a folder (directory) named C{path} with numeric mode C{mode}. The default mode is 0777 (octal). On some systems, mode is ignored. Where it is used, the current umask value is first masked out. @param path: name of the folder to create @type path: str @param mode: permissions (posix-style) for the newly-created folder @type mode: int """ path = self._adjust_cwd(path) self._log(DEBUG, 'mkdir(%r, %r)' % (path, mode)) attr = SFTPAttributes() attr.st_mode = mode self._request(CMD_MKDIR, path, attr)