home *** CD-ROM | disk | FTP | other *** search
- /* LHA-LZX V1.0 by Mat Bettinson of the Plot Hatching Factory '95
-
- Since Jonathan Forbes' brilliant LZX came along and promptly blew LHA away,
- there's a need for a bulk converter. This is such a device.
-
- Simply executing the script with the Directory to convert will result
- in each and every single LHA or LZH file in that dir being converted to LZX.
-
- You'll need LHA and LZX in your path and the Delete command.
- It also needs a fat temp dir as large as the largest uncompressed archive
- to work and this is the first thing in the script so you can alter at will.
-
- Below is the two only real values you must change. One is the Temp Dir where
- all LHA files will be extracted to. There must be enough room in this drawer
- for the largest of archives to unpack to so I DO NOT recommend RAM: unless you
- have a great DEAL of RAM. Beware! LZX eats memory too. The other parameter is
- the compression mode. It can be 1,2 or 3 varying from fastest & Lowest CR to
- Slowest & Highest CR. Even mode 1 is better than LHA.
-
- New for 2.0:
-
- Priority setting in header below.
-
- By default, will not replace LHA archives if larger using LZX.
-
- Above can be disabled so that ALL files are replaced as per original Repack by
- using the 'FORCELZX' switch after the Dir name.
-
- Filenotes are copied.
- */
-
- TempDir = 'Spot:temp/'
- Mode = '2'
- Priority = -1
-
- /*************************************************/
- /* I recommend you leave it alone from here. :-) */
- /*************************************************/
-
- Arg Dir Force
- say
- say ' *** LHA-LZX repacker 2.0 by Mat Bettinson of the Plot Hatching Factory ***'
- If Dir = '' then signal Usage
- If ~EXISTS(Dir) then signal Usage
- If Force ~= '' & Force ~= 'FORCELZX' then signal Usage
- If Force = 'FORCELZX' then ForceLZX = 1
- ELSE ForceLZX = 0
- say
- Call Pragma('S',50000)
- If right(Dir,1) ~= '/' & right(Dir,1) ~= ':' then Dir = Dir'/'
- Address COMMAND 'Assign REPACK: 'Tempdir
- Call Pragma('D','REPACK:')
- Address COMMAND 'List 'Dir' PAT #?(.LZH|.LHA) FILES LFORMAT "%n %c" >t:LHA-LZX.temp'
- Call Open(list,'t:LHA-LZX.temp','R')
- BSave = 0
- DO forever
- Line = ReadLN(list)
- File = strip(word(line,1)) ; Comment = strip(word(line,2)) ; Comment = Strip(Comment,'B','"')
- IF EOF(list) then break
- NewFile = Left(File,Length(file)-3)'LZX'
- say 'Converting file: 'File
- Address COMMAND 'Delete >NIL: REPACK:#? ALL FORCE'
- Call Open(ts,Dir||file) ; Lhasize = Seek(ts,0,'E') ; Call Close(ts)
- Address COMMAND 'LHA -a -F -M -P'Priority' x 'Dir||File' #? REPACK:'
- Address COMMAND 'LZX -r -e -M500 -'Mode' -P'Priority' -F a 'Dir||NewFile' REPACK:#?'
- Call Open(ts,Dir||NewFile) ; Lzxsize = Seek(ts,0,'E') ; Call Close(ts)
- Diff = Lhasize - Lzxsize
- If Diff > 0 | ForceLZX then DO
- Address COMMAND 'Delete >NIL: 'Dir||File
- If Comment ~= '' then Address COMMAND 'Filenote 'DIR||NewFile' "'Comment'"'
- say '* 'Diff' bytes saved on this archive!' ; say
- END
- ELSE DO
- Address COMMAND 'Delete >NIL: 'Dir||Newfile
- say '* LZX file 'ABS(Diff)' bytes larger than LZX. Keeping LHA...' ; say
- Diff = 0
- END
- BSave = BSave + Diff
- END
- Call Close(list)
- Address COMMAND 'Assign REPACK: REMOVE'
- say
- say ' *** LHA-LZX Repacker 2.0 finished. 'Bsave' bytes saved in this dir. ***'
- say
- EXIT
-
- Usage:
- say
- say 'Usage: [rx] Repack <Directory> [FORCELZX]'
- say
- EXIT
-