Simon wrote:
You could user FTP.voidcmd()
E.G.
ftp.voidcmd('RNFT filename.txt')ftp.voidcmd('RNTO newdir/filename.txt')
From the rfc:
RENAME FROM (RNFR)
This command specifies the old pathname of the file which is
to be renamed. This command must be immediately followed by
a "rename to" command specifying the new file pathname.
RENAME TO (RNTO)
This command specifies the new pathname of the file
specified in the immediately preceding "rename from"
command. Together the two commands cause a file to be
renamed.
As mentioned in my original reply, that should be what
ftplib.FTP.rename() does under the covers[1]. However, the OP
was asking about copying a file, not renaming a file.
John mentioned the poorly-supported "server-to-server copy", but
from my understanding, I think that still slurps locally and then
pushes it back up elsewhere.
-tkc
[1]
taken from ftplib.py:
def rename(self, fromname, toname):
'''Rename a file.'''
resp = self.sendcmd('RNFR ' + fromname)
if resp[0] != '3':
raise error_reply, resp
return self.voidcmd('RNTO ' + toname)
--
http://mail.python.org/mailman/listinfo/python-list