> 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