[Tutor] Getting a List of FTP Dirs?

Britt Green britt_green@hotmail.com
Fri, 02 Mar 2001 20:27:19 -0800



>From: Jörg Wölke <lumbricus@gmx.net>
>To: "Britt Green" <britt_green@hotmail.com>
>CC: tutor@python.org, tutor@python.org
>Subject: Re: [Tutor] Getting a List of FTP Dirs?
>Date: Sat, 3 Mar 2001 04:44:24 +0100 (MET)

<snip>

>from the stat module doc:
>import os,sys
>from stat import *
>
>def walktree(dir,callback):
>        for f in os.listdir(dir):
>                pathname='%s%s'%(dir,f)
>                mode=os.stat(pathname)[ST_MODE]
>                if S_ISDIR(mode):
>                       # recurse into dirs
>                       walktree(pathname,callback)
>                elif S_ISREG(mode):
>                       # regular file
>                       callback(pathname)
>                else:
>                       # anything else
>                       print "Error: Unknown file type - skipping..."
>
>is that what you're looking for?

Yeah, thats exactly what I'm looking for. Let me ask you this. In the line 
"for f in os.listdir(dir):" how do I tell Python it needs to be checking the 
remote directory, not the one on my computer?

Thanks!

Britt


--
It is pitch black. You are likely to be eaten by a grue.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com