home *** CD-ROM | disk | FTP | other *** search
- /*
- A utility that will convert all ARCED,ZOOED ZIPPED or PAKED
- files in a particular directory into LZH files for more
- efficient space saving.
- Also requires that ARC,ZOO, and UNZIP be in the C: or current directory.
- As much error checking has been built in as possible.
- December 29, 1989 - Basil 71361,2622
- */
-
- LF='0A'x
- parse upper arg inputdir
-
- If inputdir = "" then
- do
- say "Enter volume or directory to convert "
- pull inputdir
- end
- If ~exists(inputdir) then
- do
- say "That volume or directory does not exist."
- exit 10
- end
-
- /* make sure that inputdir is correctly ended */
-
- if (index(inputdir,':') == 0) then inputdir = inputdir||':'
- else if (index(inputdir,':') ~= length(inputdir)) then
- do
- if (index(inputdir,'/') ~= length(inputdir)) then inputdir = inputdir||'/'
- end
-
-
- Files = showdir(inputdir,'F')
-
- /* we're only interested in files with the correct suffix ...
- others are left alone */
-
- DO FOREVER
-
- if ~exists('ram:formatdir') then address command 'makedir ram:formatdir'
- Fileflag = 0
- Call parseout
- If firstfile = "" then leave
- select
- when Ending = '.ARC' then
- do
- address command 'copy 'inputdir||firstfile||' to ram:formatdir'
- address command 'cd ram:formatdir'LF'arc x ' firstfile LF'delete' firstfile
- fileflag = 1
- end
- when Ending = '.ZOO' then
- do
- address command 'copy 'inputdir||firstfile||' to ram:formatdir'
- address command 'cd ram:formatdir'LF'zoo x ' firstfile LF'delete' firstfile
- fileflag = 1
- end
- when Ending = '.ZIP' then
- do
- address command 'copy 'inputdir||firstfile||' to ram:formatdir'
- address command 'cd ram:formatdir'LF'unzip 'firstfile LF
- fileflag = 1
- end
- when Ending = '.PAK' then
- do
- address command 'copy 'inputdir||firstfile||' to ram:formatdir'
- address command 'cd ram:formatdir'LF firstfile LF'delete' firstfile
- fileflag = 1
- end
- otherwise
- end
-
- If fileflag = 1 then
- do
- newfile = left(firstfile,(length(firstfile)-4))||'.LZH'
- contents = showdir('ram:formatdir','F')
- address command 'cd ram:formatdir'LF'lharc a '||newfile||' *'LF
- if rc ~= 0 then exit
- address command 'delete 'inputdir||firstfile LF
- address command 'copy ram:formatdir/'||newfile||' to 'inputdir LF
- address command 'delete ram:formatdir all' LF
- end
-
-
- END
-
- /* ********************* END OF MAIN PROGRAM ********************* */
-
- parseout:
-
- /* recursive parsing routine that pulls out and uses the
- first file of the list. */
-
- parse var Files firstfile Files
-
- /* let's extract the suffix */
-
- if firstfile ~= "" then
- do
- Dotposition = length(firstfile)-3
- Ending = substr(firstfile,Dotposition,4)
- end
-
- return
-
-