I've done this several times using Perl, or just a simple shell script
Perl runs on EVERY platform, including OS9.

Here is an example script - I use this one, and I know it works.
I modified it for the ".txt" search you wanted.
Just set the ISTXT environment var in Tango to 1:

#!/usr/local/bin/perl

# listFiles.pl
# Simple program for listing directory contents, usable from within Tango.
# In the External Action, you must have the following ENV variables set:
# UNIXPATH: The path to the directory you are listing from the root
# WEBROOT:      Optional "root" directory substitute from which to begin
searching
# DIR:      1 if you want to list ONLY directories not files.
# ISTAF:        1 if you want only to list .TAF files.
# ISTXT:        1 if you want only to list .TXT files.
# The result in Tango will be an array of the resulting filenames or
directory names

# Written by Jim Kass 2003

if ( $ENV{'DIR'} == 1 ) {
  $display = qx (/bin/ls -1F $ENV{'WEBROOT'}$ENV{'UNIXPATH'} | grep /);
}
elsif ( $ENV{'ISTAF'} == 1 {
  $display = qx (/bin/ls -1 $ENV{'WEBROOT'}$ENV{'UNIXPATH'} | grep .taf);
} elsif ( $ENV{'ISTXT'} == 1 {
  $display = qx (/bin/ls -1 $ENV{'WEBROOT'}$ENV{'UNIXPATH'} | grep .txt);
} else {
  $display = qx (/bin/ls -1 $ENV{'WEBROOT'}$ENV{'UNIXPATH'});
}

print $display;




-----Original Message-----
From: Jonah Simpson [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 18, 2004 11:47 PM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: List of files in a folder


Hey All!

The other option is to write a (apple?)script to do a search or directory
listing. Then run that as an external action. I believe that <@var
request$resultset> inside the results portion of the external action will
contain the console output from the external action, so you could then parse
out the the filenames.

I'm not sure if there's any easy way to do the parsing. Last time I checked
(in about 2000) the <@regex> tag didn't work well or was buggy or something
(I can't remember), so you'll probably have to use a method similar to what
Wayne is using to parse out his file.

Hope this helps!

Cheers,
Jonah Simpson

----- Original Message -----
From: "Wayne Irvine" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 19, 2004 12:27 AM
Subject: Re: Witango-Talk: List of files in a folder


>
> > I need to list any files in a particular folder and assign the list to
an
> > array.
> >
> > Is there a way of doing this in Tango 2000 on a Mac running OS 9?
>
>
> Here's how I did it:
>
> First, I set up the webserver to give a directory index, then I use the
@URL
> tag to load the HTTP into a VAR.
>
> <@ASSIGN NAME=FileListPage Value=<@URL
> Location="http://www.thedomain.com.au/isellit/updatefiles/index.dir";>
> SCOPE=local>
>
> Then I parsed that VAR to extract all the .TXT files (I know the length so
> it was easy) in a while loop. Each file name is delimited by [ROW].
>
> While <@LOCATE STR=<@VAR local$FIleListPage> FINDSTR=".TXT"> !=0
>
> <@ASSIGN NAME=CurrPos VALUE=<@CALC EXPR='<@LOCATE STR=<@VAR
> local$FileListPage> FINDSTR=".TXT">-11'> SCOPE=local>
>
>
> <@ASSIGN NAME=FileList VALUE='<@VAR local$FileList><@SUBSTRING STR=<@VAR
> local$FileListPage> START=@@local$CurrPos NUMCHARS=15>[ROW]' SCOPE=LOCAL>
>
> <@ASSIGN NAME=FileListPage VALUE=<@RIGHT STR=<@VAR local$FileListPage>
> NUMCHARS=<@CALC '<@LENGTH STR=<@VAR local$FileListPage>>-<@VAR
> local$CurrPos>-15'>  SCOPE=LOCAL>>
>
> Then I loaded the resulting string as an array into another VAR
>
> <@ASSIGN NAME=FileListArray VALUE=<@ARRAY VALUE=<@VAR local$FileList>
> RDELIM='[ROW]' CDELIM='[COL]'> SCOPE=LOCAL>
>
> And removed duplicates using the DISTINCT tag
>
> <@ASSIGN NAME=DistinctFileListArray VALUE=<@DISTINCT
> ARRAY="local$FileListArray"> SCOPE=LOCAL>
>
> The only issue is that the index.dir only returns the first 100 records
but
> that is ok as this task is reiterative until there are no more .txt files.
>
> Wayne Irvine
>
>                   Byte Services Pty Ltd
>                http://www.byteserve.com.au/
>                   [EMAIL PROTECTED]
>    Ph 02 9960 6099   Mob 0409 960 609   Fax 02 9960 6088
>
> ________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
>

Jim Kass
Sr. Web-Applications Developer

--
Forestweb: The Source for Industry Intelligence
Best Content -- Most Relevant -- Best Delivery
http://www.forestweb.com
(310) 553 - 0008



________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf



________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to