Calling ftp commands from python

Mike Meyer mwm at mired.org
Thu Sep 1 05:10:54 CEST 2005


"Thierry Lam" <lamthierry at gmail.com> writes:

> Is it possible to run an ftp command to connect to some remote computer
> on the network.

Yes, but why would you want to do taht?

> For example, if I want to retrieve some data from
> \\remcomputer\datafiles on the network and copy it to my local
> computer, how do I do it in python on the Unix side?

Start with "import ftplib". Use ftplib to read the file, and write it
out wherever you want it - or don't, if the goal was to get the
contents of the file into your Python program. The API is sorta ugly,
but it works, and comes with Python.

         <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list