[Tutor] ftp stuff

Andrei Kulakov ak@silmarill.org
Mon, 25 Feb 2002 14:04:39 -0500

On Mon, Feb 25, 2002 at 10:39:25AM -0800, james middendorff wrote:
> Hello,
> I am trying to build a program that will connect to a ftp server i.e. ftp://ftp.slackware.com and then change to a certain directory i.e. /pub/slackware/slackware-current, which I have gotten all of that to work, but when I get to that directory I want to do a LIST command, which I cannot get to work, is there something that I am overlooking, also I want this to go into all directories of slackware-current and download certain files, how can I make itgo into these directories download something, and then go to the next one?

def process(line):
    [ process line ]

conn.retrlines("LIST", process)

conn is your connection instance.

If I remember right, the last line will repeatedly call process function
with lines that it gets from LIST, one line at a time.

This looks a bit unusual but I think the idea is that if the listing is
large and connection is slow, you want to get one line and process it
and then get another line, because it'd be slower to wait till you get
all lines and then wait till you process them..

> I hope I have explained myself well enough thanks for any help
> james
> "I would kill everyone in this room
>     for a drop of sweet beer."
>      ----Homer Simpson----
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games

Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org