🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.msdos.misc
1 messages
1 total messages Started by John Savage Wed, 22 Nov 1995 00:00
batch file to unzip each .ZIP file to its own directory (repost)
#3933
Author: John Savage
Date: Wed, 22 Nov 1995 00:00
50 lines
2540 bytes
To explain this .bat script: you have downloaded a few .ZIP files from
some site, and need to unzip each and run them -- to test whether the
programs do what you hope and are worth keeping. Usually, this means
creating a handful of subdirectories, and unzipping one .ZIP into each.

This batch program does that task for you: it will create a subdirectory
[within the current directory] named according to each of the .ZIP files
specified, and unzip each file into its own directory. For example, a
file named DC106F.ZIP will be unzipped into a subdirectory named DC106F

The .ZIP file extension can be omitted, and wildcards and drive letters
are allowed, though I have written it so that the drive letter need be
specified only once, and is assumed to apply to all following filenames.

Examples:  UNZIP2D  A:*.*

           UNZIP2D  A:DC*.*  LIST*.*  BATMNU21  READ131  SETEN*.*


UNZIP2D.BAT:
-----------
@echo off
if "%1" == "+" goto T
if "%1%2" == "" echo  usage:  unzip2d  a:*.*  b:file2.zip  ...
set d=
for %%f in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do call c:unzip2d + %%f
goto X

:T
for %%i in (/%2) do set r=%%i
set c=%r%
for %%i in (/%2) do if not %%i==%r% set c=%%i
if %r% == %2 set r=.zip
if %c% == . goto W
if %c% == : set d=%3:
if not %c% == : set r=%r% %3%c%
call c:unzip2d + %r%
goto X

:W
if exist %d%%3.%r% mkdir %3
pkunzip %d%%3.%r% %3
:X

I have used this with DOS 5, but cannot say it will work for all versions.
It is a peculiarity with DOS that where you use a wildcard in the filename
then you must also specify the file extension (either as .zip or just .*).
Of course, the pkunzip (or equivalent) executable needs to be in your PATH.
--
John Savage               koala@sydney.dialix.com.au
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads