ftp and python

Simon simonluijk at googlemail.com
Thu Apr 8 09:08:15 EDT 2010


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.

P.S. Sorry about emailing that direct to you John :(


On 8 April 2010 07:24, John Nagle <nagle at animats.com> wrote:

> Tim Chase wrote:
>
>> Matjaz Pfefferer wrote:
>>
>>> What would be the easiest way to copy files from one ftp
>>> folder to another without downloading them to local system?
>>>
>>
>> As best I can tell, this isn't well-supported by FTP[1] which doesn't seem
>> to have a native "copy this file from server-location to server-location
>> bypassing the client". There's a pair of RNFR/RNTO commands that allow you
>> to rename (or perhaps move as well) a file which ftplib.FTP.rename()
>> supports but it sounds like you want too copies.
>>
>
>   In theory, the FTP spec supports "three-way transfers", where the
> source, destination, and control can all be on different machines.
> But no modern implementation supports that.
>
>                                        John Nagle
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100408/d78c0e1e/attachment-0001.html>


More information about the Python-list mailing list