[Q]How do one determine if a ftp link is to a directory or a file ?

Alexander Lazarević Alexander at Lazarevic.de
Tue Jul 29 09:52:17 UTC 2003


Hi Karl!

The output format of the list command varies with ftp servers. I once used the 
attached files as a quick and dirty solution. The author claims to handle 
output for the following servers:

EPLF.
UNIX ls, with or without gid.
Microsoft FTP Service.
Windows NT FTP Server.
VMS.
WFTPD.
NetPresenz (Mac).
NetWare.
MSDOS.

I created a shared library and called the function ftpparse from smalltalk 
with ever line of output produced by a list command. The structure ftpparse 
you get back contains a 1 in flagtrycwd, if a cwd is worth to try (directory, 
link to dir) or a 0 if not (file, link to file).

I used this to have something up and running in no time. Doing something 
similiar in Smalltalk should be no problem and maybe the attached files can 
help you in doing so.

Alex

Am Dienstag, 29. Juli 2003 10:15 schrieb Karl Ramberg:
> How do one determine if a link in a ftp server is a link to a directory
> or a file ?
> Just looking at the returned ftp entry answers these strings, first one
> a file,
> second a directory:
>
>
> 'lrwxrwxrwx    1 1137     1100           36 Apr 12 07:12
> SqueakV3.sources.gz -> ../sources_files/SqueakV3.sources.gz'
> 'lrwxrwxrwx    1 0        1               5 Apr 24 11:15 pub -> .pub1'
>
>
>
> Do one have to follow the link and the see if it returns a directory or
> file, or can
> one get the info just from the returned string ?
>
> Karl

-- 
Holland klagt über Rattenplage aus Deutschland: "Aus Deutschland sind so viele 
Ratten nach Holland abgewandert – hier in Köln-Mülheim stehen schon die 
ersten Häuser leer." -- Harald Schmidt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftpparse.c
Type: text/x-csrc
Size: 13499 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030729/ebf96341/ftpparse.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ftpparse.h
Type: text/x-chdr
Size: 1719 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030729/ebf96341/ftpparse.h


More information about the Squeak-dev mailing list