[Tutor] Getting a List of FTP Dirs?
Britt Green
britt_green@hotmail.com
Fri, 02 Mar 2001 19:08:55 -0800
Hello all,
Part of my job duties is to check an FTP backup site and insure that a bunch
of files have backed up for that day. I have to check 300 folders. Ugh. So
in a meeting today with a new boss, I said that this was a waste of time,
and that someone should code up a program to automatically check it.
Unwisely, I said, "Its easy! I could write something like that."
Now I have to do it. :)
So, I've been playing with ftplib a bit and its very useful. However, this
is what I'm stuck on. Say I have this listing of directories:
drwxrwx--- 2 restback privftp 512 Mar 2 20:17 spice
drwxrwx--- 2 restback privftp 512 Mar 2 20:03 terradisiena
drwxrwx--- 2 restback privftp 512 Mar 2 20:22 tiburongrille
drwxrwx--- 2 restback privftp 512 Mar 2 20:35 toulouse
drwxrwx--- 2 restback privftp 512 Mar 2 20:50 vangoghs
How do I tell my program that spice, terradisiene, etc are directories it
needs to go into? Since we regularly add and delete directories, I can't
create a static file of them. My program needs to take a line like this:
drwxrwx--- 2 restback privftp 512 Mar 2 20:17 spice
and understand that the last word in it will be a directory it needs to
enter. And, I also need to let my program know when its done reading the
listing of directories.
I could probably write something that creates a tuple, and to take the last
element in that tuple as the directory, but beyond that I"m a bit lost.
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