call addlib('rexxsupport.library',0,-30,0)
version = "DeArchive V1.4 (6/2/95)"
parse arg SourceDir DestDir
If ~Exists(compress(compress(DestDir),'/')) then
Do
say('[1;32mCreating destination directory![0m')
If ~makedir(compress(compress(DestDir),'/')) = 1 then
Do
say ('OH NO, cant create destination directory!')
exit
End
End
if SourceDir = '?' then
do
options prompt 'SOURCE/A,DESTINATION: '
pull SourceDir DestDir
end
if SourceDir = '' then
do
say "[1mI need a source Dir!![0m"
say ''
say '[1;32m'version'[0m - The Arexx Lha/Lzh/Zip Batch De-Archiver'
say '[1;3;33mWritten By SlingShot/Dimentia U.K 94/95[0m'
say ''
say '[3;4;32mUsage:[0m'
say '        [4;33mDeArchive[0m [1;32m<Source Directory>[0m [1;33m[Destination][0m'
say '        [Destination] is optional and current'
say '        directory will be used if non is provided.'
say ''
say '        NOTE: Archives must have .Lha/Lzh/Zip extensions'
say '        NOTE: LHA/UnZip must be in the current path.'
exit
end
else
if ~exists(SourceDir) then
do
say "[1mNo such directory or device![0m"
say ''
say '[1;32m'version'[0m - The Arexx Lha/Lzh/Zip Batch De-Archiver'
say '[1;3;33mWritten By SlingShot/Dimentia U.K 94/95[0m'
say ''
say '[3;4;32mUsage:[0m'
say '        [4;33mDeArchive[0m [1;32m<Source Directory>[0m [1;33m[Destination][0m'
say '        [Destination] is optional and current'
say '        directory will be used if non is provided.'
say ''
say '        NOTE: Archives must have .Lha/Lzh/Zip extensions'
say '        NOTE: LHA/UnZip must be in the current path.'
exit
end
if right(SourceDir, 1) ~= ':' & right(SourceDir, 1) ~= '/' then
SourceDir = SourceDir || '/'
if DestDir = '' then
DestDir = pragma('D') || '/'
else
if right(DestDir, 1) ~= ':' & right(DestDir, 1) ~= '/' then
DestDir = DestDir || '/'
address command
'LIST' SourceDir 'p=(#?.lha|#?.lzh|#?.zip) quick files nohead to ram:temp'
'RESIDENT c:lha force'
If open('fh','ram:temp','r') then
Do
text = readln('fh')
text = strip(text)
call close('fh')
if text = '' then check = 0 
Else check = 1
End
Else
check = 2
If check = 2 then
Do
say 'Oh no...I cant open ram:temp, the listings file!! PROBLEM!'
exit
End
If check ~= 0 then
If open('FileHandle','ram:temp','R') then
Do until eof('FileHandle')
text = readln('FileHandle')
If UPPER(right(text, 3)) = 'LHA' | UPPER(right(text, 3)) = 'LZH' then
Do
say ('[1;4;33mLHA/LZH Archive:[0m')
'lha e 'SourceDir || text DestDir || left(text,(length(text)-4)) || '/'
End
Else
If UPPER(right(text, 3)) = 'ZIP' then
Do
say ('[1;4;32mZIP Archive:[0m')
'unzip 'SourceDir || text '-d' DestDir || left(text,(length(text)-4)) || '/'
End
End
Else
Do
say "Cant open Source file listing file - Ram:temp"
exit
End
Else
say 'No LHA/LZH/ZIP files found!'
call close('FileHandle')
'delete ram:temp quiet'
'RESIDENT lha remove'
exit
 