home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR24
/
WUZ10A.ZIP
/
WUZ.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-12-14
|
4KB
|
180 lines
/* unzip/arj/pac etc and open folder */
/* (c) Copyright 1993 Scott Maxwell. */
Drive = 'E:'
DestPath = 'E:\Download\temp\'
NoCommandLine = 0
WaitForUnzip = 0
arg Name
if Name = '' then SIGNAL ShowUsage
CurrentDir = Directory()
Yes = 1
No = 0
Extractor. = 'unzip -o -d'
CopyTo. = No
Update. = ''
UpdateP. = ''
Fresh. = ''
Extractor.ARC = '@arc xo'
Fresh.ARC = '@arc f'
Extractor.ARJ = '@unarj x'
Extractor.LZH = '@lh x /s /o'
Extractor.Z = '@compress -d'
CopyTo.Z = Yes
Extractor.TAR = '@tar xf'
CopyTo.TAR = Yes
Extractor.ZIP = '@unzip -o -d'
Update.ZIP = '@zip -r -u'
UpdateP.ZIP = '-x zclr.cmd zupdate.cmd zfresh.cmd'
Fresh.ZIP = '@zip -r -f'
Extractor.ZOO = '@zoo x'
CopyTo.ZOO = No
if Length(CHARIN(Name,1,1)) \= 1 then do
say Name 'not found.'
exit(1)
END
Call CHAROUT(Name)
call GetDriveSpec Name
if Ext="" then SIGNAL ShowUsage
if NameOnly="" then SIGNAL ShowUsage
Dest=DestPath||NameOnly
CALL RxFuncAdd 'SysMkDir','RexxUtil','SysMkDir'
CALL SysMkDir Dest
CALL RxFuncAdd 'SysFileDelete','RexxUtil','SysFileDelete'
Call SysFileDelete Dest'\zclr.cmd'
Call CHAROUT Dest'\zclr.cmd',"@cd .."'0d'x'0a'x
Call CHAROUT Dest'\zclr.cmd',"@detach Kill-Dir" Dest "> nul"'0d'x'0a'x
Call CHAROUT Dest'\zclr.cmd',"@if '%1'=='-x' exit"'0d'x'0a'x
Call CHAROUT Dest'\zclr.cmd'
'@attrib +h' Dest'\zclr.cmd > nul'
if Update.Ext \= '' then do
Call SysFileDelete Dest'\zupdate.cmd'
Call CHAROUT Dest'\zupdate.cmd','@zipstrip' FullPath'0d'x'0a'x
Call CHAROUT Dest'\zupdate.cmd',Update.Ext FullPath '*' UpdateP.Ext
Call CHAROUT Dest'\zupdate.cmd'
'@attrib +h' Dest'\zupdate.cmd > nul'
end
if Fresh.Ext \= '' then do
Call SysFileDelete Dest'\zfresh.cmd'
Call CHAROUT Dest'\zfresh.cmd',Fresh.Ext FullPath '*'
Call CHAROUT Dest'\zfresh.cmd'
'@attrib +h' Dest'\zfresh.cmd > nul'
end
if WaitForUnzip = 0 then do
if NoCommandLine = 1 then
Call 'Open-Dir' Dest
else
if Check4OS2()=1 then
'@start "'NameOnly'.'Ext'" /l /fg post-wuz.cmd' Dest Left(Fresh.Ext,1) Left(Update.Ext,1)
else
'@start "'NameOnly'.'Ext'" /f post-wuz.cmd' Dest Left(Fresh.Ext,1) Left(Update.Ext,1)
end
if Extractor.Ext \= '' then do
holdDir = DIRECTORY(Drive)
Call Directory(Dest)
if CopyTo.Ext = Yes then do
'@copy' FullPath Dest '> nul'
'@attrib -r -h -s' FullName '> nul'
Param1 = FullName
end
else
Param1 = FullPath
Extractor.Ext Param1
if CopyTo.Ext = Yes then
Call SysFileDelete Param1
end /* Do */
if WaitForUnzip = 1 then do
if NoCommandLine = 1 then
Call 'Open-Dir' Dest
else
if Check4OS2()=1 then
'@start "'NameOnly'.'Ext'" /l /fg post-wuz.cmd' Dest Left(Fresh.Ext,1) Left(Update.Ext,1)
else
'@start "'NameOnly'.'Ext'" /f post-wuz.cmd' Dest Left(Fresh.Ext,1) Left(Update.Ext,1)
end
Call Directory holdDir
Call Directory CurrentDir
exit(0)
GetDriveSpec: procedure expose FullPath FullName NameOnly Ext
arg Name
fDrive = FILESPEC('Drive',Name)
fPath = FILESPEC('Path',Name)
fName = FILESPEC('Name',Name)
Dir.1 = 'DIRECTORY'()
if fDrive = '' then
fDrive = FILESPEC('Drive',Dir.1)
Dir.2 = DIRECTORY(fDrive)
if fPath = '' then
fPath = FILESPEC('Path', Dir.2)
if Left(fPath,1) \= '\' then do
Dir.3 = directory(fPath)
fPath = FILESPEC('Path', Dir.3)
Call Directory Dir.2
end
Call Directory Dir.1
FullPath = fDrive||fPath||fName
FullName = fName
ExtPos = LASTPOS(".",fName)
if ExtPos=0 then do
Ext = ''
NameOnly = fName
end
else do
Ext = SUBSTR(fName,ExtPos+1)
NameOnly = LEFT(fName,ExtPos-1)
end
return
Directory: procedure
arg Name
if Length(Name) > 3 then
if Right(Name,1) = '\' then
Name = Left(Name,LENGTH(Name)-1)
n = 'DIRECTORY'(Name)
if Right(n,1) \= '\' then
n = n'\'
return n
Check4OS2: procedure
'@set is4os2=%_4ver'
return DATATYPE(VALUE(is4os2,,OS2ENVIRONMENT),'N')
ShowUsage:
say "USAGE: wuz filename.[ARJ|LZH|TAR|Z|ZIP|ZOO]"
exit