Example #1
0
 def truncate(self, size):
     """
     Change the size of this file.  This usually extends
     or shrinks the size of the file, just like the C{truncate()} method on
     python file objects.
     
     @param size: the new size of the file
     @type size: int or long
     """
     self.sftp._log(DEBUG, 'truncate(%s, %r)' % (hexlify(self.handle), size))
     attr = SFTPAttributes()
     attr.st_size = size
     self.sftp._request(CMD_FSETSTAT, self.handle, attr)
Example #2
0
 def truncate(self, size):
     """
     Change the size of this file.  This usually extends
     or shrinks the size of the file, just like the C{truncate()} method on
     python file objects.
     
     @param size: the new size of the file
     @type size: int or long
     """
     self.sftp._log(DEBUG,
                    'truncate(%s, %r)' % (hexlify(self.handle), size))
     attr = SFTPAttributes()
     attr.st_size = size
     self.sftp._request(CMD_FSETSTAT, self.handle, attr)
    def truncate(self, path, size):
        """
        Change the size of the file specified by C{path}.  This usually extends
        or shrinks the size of the file, just like the C{truncate()} method on
        python file objects.

        @param path: path of the file to modify
        @type path: str
        @param size: the new size of the file
        @type size: int or long
        """
        path = self._adjust_cwd(path)
        self._log(DEBUG, 'truncate(%r, %r)' % (path, size))
        attr = SFTPAttributes()
        attr.st_size = size
        self._request(CMD_SETSTAT, path, attr)
Example #4
0
    def truncate(self, path, size):
        """
        Change the size of the file specified by C{path}.  This usually extends
        or shrinks the size of the file, just like the C{truncate()} method on
        python file objects.

        @param path: path of the file to modify
        @type path: str
        @param size: the new size of the file
        @type size: int or long
        """
        path = self._adjust_cwd(path)
        self._log(DEBUG, 'truncate(%r, %r)' % (path, size))
        attr = SFTPAttributes()
        attr.st_size = size
        self._request(CMD_SETSTAT, path, attr)