def rename(self, targetFile, newName, connId='<STR_LIT:default>'):
thisConn = self.__getConnection(connId)<EOL>outputMsg = "<STR_LIT>"<EOL>try:<EOL><INDENT>outputMsg += str(thisConn.rename(targetFile, newName))<EOL><DEDENT>except ftplib.all_errors as e:<EOL><INDENT>raise FtpLibraryError(str(e))<EOL><DEDENT>if self.printOutput:<EOL><INDENT>logger.info(outputMsg)<EOL><DEDENT>return outputMsg<EOL>
Renames (actually moves) file on FTP server. Returns server output.
Parameters:
- targetFile - name of a file or path to a file to be renamed
- newName - new name or new path
- connId(optional) - connection identifier. By default equals 'default'
Example:
| rename | tmp/z.txt | /home/myname/tmp/testdir/z.txt |