ftp and python
Tim Chase
python.list at tim.thechases.com
Wed Apr 7 21:25:10 EDT 2010
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.
When I've wanted to do this, I've used a non-FTP method, usually
SSH'ing into the server and just using "cp". This could work for
you if you have pycrypto/paramiko installed.
Your last hope would be that your particular FTP server has some
COPY extension that falls outside of RFC parameters -- something
that's not a portable solution, but if you're doing a one-off
script or something in a controlled environment, could work.
Otherwise, you'll likely be stuck slurping the file down just to
send it back up.
-tkc
[1]
http://en.wikipedia.org/wiki/List_of_FTP_commands
More information about the Python-list
mailing list