Also, for the Rexx programming guru's out there, can someone tell me how to parse the name from 'firefox-8.0.1.en-US.os2' to 'Firefox-8.0.1' for the name of the installation directory.
PARSE VALUE FILESPEC( full_path_name, 'N' ) WITH ff_name'.en-'.
And I need a way to delete all the files and directories in a firefox directory, except 'firefox.exe', 'firefox!K.exe', and 'firefox.ico' using a Rexx script.
Greggory
A shortend version of the code RobertM provided.
/* List files and delete each of them */
/* Create Match list of do-not-deletes, upper case! */
NoDel.1='FIREFOX.EXE'
NoDel.2='FIREFOX!K.EXE'
NoDel.3='FIREFOX.ICO'
NoDel.0=3 /* Set stem array length */
/* Read directory and all sub-directories and create file list in stem array filelist, take care of possible trailing back slash */
/* We only care about the fully qualified path names and in subfolders as well, so use "O" option to drop dates, times, attribs, etc */
rtc = SysFileTree( STRIP( fDir, 'T', '\' )||"\*", "filelist", "SFO" )
/* Create worker loops */
Do A = 1 to filelist.0 /* Loop through file list using count in stem base */
Do B = 1 to NoDel.0 /* Compare to each value in NoDel array */
If Pos( NoDel.B, Translate( filelist.A ) ) > 0 Then /* found a match - using upper case to ensure proper matching */
Iterate A /* Jump to the next file in the list and don't process this one! */
End
rtc = SysFileDelete( filelist.A /* corrected from B to A */ ) /* delete file */
/* Add programming code here to check error codes if wanted - for instance cant delete because locked file */
/* If rtc = 0 Then Say FileSpec( filelist.A, 'N' ) 'deleted' */
End
Another way to do this:
If Pos( NoDel.B, Translate( filelist.A ) ) > 0 Then /* found a match - using upper case to ensure proper matching */
is to write
If NoDel.B = Translate( FileSpec( filelist.A, 'N' ) ) Then
which will match files with the whole file name (no path) so that we don't get a positive match with
nofirefox.exe that we'd get with Pos( ... )
Compare this example:
filelist.A = 'C:\path\Firefox-8.0.1\nofirefox.exe'
Pos( NoDel.B, Translate( filelist.A ) ) > 0 ---> POS( FIREFOX.EXE, C:\PATH\FIREFOX-8.0.1\NOFIREFOX.EXE ) >0 that is 24 > 0 which equals TRUE
while the comparison
NoDel.B = Translate( FileSpec( filelist.A, 'N' ) ) ---> FIREFOX.EXE = NOFIREFOX.EXE equals FALSE
Each archive I've seen contain the folder "firefox", "thunderbird" etc. depending on content so you could probably use unzip32.dll directly in rexx to find out what package you're actually handling and unzip files accordingly. I found unzip32.dll useful once I tried it, but the documentation in Tips & Tricks is a must.
You could probably replace "firefox" in the array NoDel.1 to 3 with names from the path in the .zip-file (list with unzip32.dll). That way you could use one script to install Firefox, Thunderbird and Seamonkey.

//Jan-Erik