Using the ftp lib to rename a file

Martin von Loewis loewis at informatik.hu-berlin.de
Sun May 27 10:50:25 EDT 2001


feraudyh at valise.com (Henri de Feraudy) writes:

> Can anyone show me a sample illustrating how I can use the ftp lib
> from my client station to rename a file on the server?
> The ftplib doc is a bit minimal.

Looking at

http://www.python.org/doc/current/lib/ftp-objects.html

you can see that FTP objects offer a rename operation, with the
signature .rename(fromname, toname). So the sample illustrating
renaming would look like

ftp = ftplib.FTP(server, user, pass)
# if needed, do ftp.cwd(directory) here
ftp.rename(fromname, toname)

Which of these three lines was unclear from the documentation?

Regards,
Martin



More information about the Python-list mailing list