[comp.binaries.ibm.pc.d] ZOO2ZIP.BAT - reposted with minor improvements

bradd@gssc.gss.com (Brad Davis) (01/05/91)

The ZOO2ZIP.BAT that I posted the other day used a Unix-style RM to remove
temporary files generated during conversion.  Some kind soul pointed out
a little DOS trick that can do the same thing without having to use
portabilty-limiting external tools.

The ZOO2ZIP below does the same job as the original but needs only the
built-in DOS commands and (obviously) ZOO.EXE and PKZIP.EXE.  I also polished
up the ECHOs and etc to make the screen output look a little neater...


Since there seems to be some danger of the ZIP vs. ZOO war breaking out again,
I thought I might contribute a little batch program to help my fellow ZIP fans
be content with a ZOO-oriented group.

With ZOO2ZIP, converting .ZOOs to .ZIPs is trivial - just type ZOO2ZIP *.ZOO
and there are your .ZIPs.  You can delete the .ZOO files and you never have to
mess with ZOO again.  (You could modify ZOO2ZIP.BAT to delete the .ZOOs
automatically if you wanted to, but I prefer to do that manually.)

Zoo2Zip is actually *two* batch files:  ZOO2ZIP.BAT breaks up wildcards into
individual file names and CALLs _ZOO2ZIP.BAT for each file in turn.

Note that ZOO2ZIP requires at least DOS 3.3 (or 4DOS) since the CALL command
was not included in older versions of DOS.  (4DOS, for those who haven't seen
it yet, is a very slick replacment for COMMAND.COM.  Highly recommended.)

If I get requests from users of older DOS versions begging for a pre-DOS 3.3
version of Zoo2Zip, I'll cook one up and post it here also.  (Unless I get
severely chastised for posting "binaries" in a .d group, that is :-)

Here is ZOO2ZIP.BAT
------8<------- Clip and save ------8<--------- Valuable coupon -------8<-----
@echo off
if "%1" == "" goto help

rem Temp files in _z2ztmp_
mkdir _z2ztmp_
if errorlevel 1 goto exists

rem Accumulate ZIP files in _z2zzip_
mkdir _z2zzip_
if errorlevel 1 goto exists

:loop
for %%f in (%1) do call _zoo2zip %%f
if errorlevel 1 goto exists

shift
if not "%1" == "" goto loop

rd _z2ztmp_
copy _z2zzip_\*.* *.zip > nul
echo y | del _z2zzip_ > nul
rd _z2zzip_
goto end

:help
echo Usage: zoo2zip FILE [FILE [...]]
echo	where FILE is the name of a .ZOO file to be converted.
echo	Wildcards are OK.
goto end

:exists
echo    Unable to create temp directories _z2ztmp_ and/or _z2zzip_
:end
------8<------- Clip and save ------8<--------- Valuable coupon -------8<-----

Here is _ZOO2ZIP.BAT
------8<------- Clip and save ------8<--------- Valuable coupon -------8<-----
@echo off
echo Converting: %1
if "%1" == "" goto error

cd _z2ztmp_
zoo -extract ..\%1
cd ..
pkzip -a -ex _z2zzip_\%1 _z2ztmp_\*.*
echo y | del _z2ztmp_\*.* > nul
echo ---
goto end

:error
echo ERROR processing %1
:end
------8<------- Clip and save ------8<--------- Valuable coupon -------8<-----

Random drivel from the keyboard of:                                   +--+
  Brad Davis, GSS Inc, Beaverton OR  _________ -_--_  ________________|80|__
  bradd@gssc         (503) 641-2200    --  --  =o==o=  --  --  --  -- +__+
Disclaimer: The boss disavows        ----------------------------------||---
  all knowledge of my actions.       Whfg fnl AB gb 65!                ||

jaapv@accucx.cc.ruu.nl (Jaap Verhage) (01/08/91)

In article <6496@gssc.UUCP> bradd@gssc.gss.com (Brad Davis) writes:
[...]
>Note that ZOO2ZIP requires at least DOS 3.3 (or 4DOS) since the CALL command
>was not included in older versions of DOS.
It seems to me that if you change the CALL command into COMMAND/C,
that would be all ... should work for DOS 3.X, at least.
-- 
Regards, Jaap.

Jaap Verhage, Academic Computer Centre, State University at Utrecht, Holland.
jaapv@cc.ruu.nl      +<-*|*->+      I claim *every*thing and speak for myself