home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 13 / CD_ASCQ_13_0494.iso / news / 2417 / uc2 / u2_exzip.bat < prev    next >
DOS Batch File  |  1993-12-31  |  2KB  |  110 lines

  1. @echo off
  2. echo off
  3. rem (C) Copyright 1993, Ad Infinitum Programs, all rights reserved
  4.  
  5. rem U2_EXZIP.BAT accepts a single parameter: an archive file. It
  6. rem decompresses all files (including hidden ones, etc.) of this archive
  7. rem completely into the current directory. If nothing goes wrong, the files
  8. rem U$~CHK1 and U$~CHK2 are created by this batch file. UC tests for the
  9. rem presence of those files.
  10.  
  11. rem 1. PK(UN)ZIP 2.0
  12. rem 2. PK(UN)ZIP 1.x
  13. rem 3. (INFO)ZIP
  14.  
  15. rem ***  PK(UN)ZIP 2.0  ***
  16.  
  17.    rem If PKUNZIP 2.04ceg fails, (InfoZIP) UNZIP 5.x is often able to do
  18.    rem the job instead.
  19.  
  20.       echo check > u$~chk1
  21.  
  22.    rem Add file to archive. 'echo x' is to skip the help screen which is
  23.    rem given in case of unknown options (errorlevel 16).
  24.  
  25.       echo x | PKZIP -3 -+ -- -) %1 u$~chk1
  26.       if errorlevel 16 goto zip110
  27.       del u$~chk1
  28.  
  29.    rem Expand archive
  30.  
  31.       PKUNZIP -3 -+ -- -) -Jrhs -o -d %1
  32.  
  33.    rem Test for correct expansion
  34.  
  35.       if not exist u$~chk1 goto retry1
  36.       if errorlevel 1 goto retry1
  37.       goto ok
  38.  
  39.  
  40. :zip110
  41. rem ***  PK(UN)ZIP 1.x  ***
  42.  
  43.    rem Add file to archive
  44.  
  45.       echo check > u$~chk1
  46.       PKZIP %1 u$~chk1
  47.       del u$~chk1
  48.  
  49.    rem Expand archive
  50.  
  51.       PKUNZIP -Jrhs -o -d %1
  52.  
  53.    rem Test for correct expansion
  54.  
  55.       if not exist u$~chk1 goto retry1
  56.       if errorlevel 1 goto retry1
  57.       goto ok
  58.  
  59. :retry1
  60.  
  61.    rem handle the case where PKZIP is present and PKUNZIP isn't
  62.  
  63.       echo x | pkzip -3 -+ -- -) -d %1 u$~chk1
  64.       if not errorlevel 16 goto cont
  65.       pkzip -d %1 u$~chk1
  66.  
  67.  
  68. :cont
  69. rem ***  ZIP  ***
  70.  
  71.    rem Add file to archive
  72.  
  73.       echo check > u$~chk1
  74.       ZIP %1 u$~chk1
  75.       del u$~chk1
  76.  
  77.    rem Expand archive
  78.  
  79.       UNZIP -o %1
  80.  
  81.    rem Test for correct expansion
  82.  
  83.       if errorlevel 1 goto error
  84.       if not exist u$~chk1 goto error
  85.       goto ok
  86.  
  87.  
  88. :error
  89. rem *** Error handling ***
  90.  
  91.    if exist u$~chk1 del u$~chk1
  92.    if exist u$~chk2 del u$~chk2
  93.    goto end
  94.  
  95.  
  96. :ok
  97. rem *** Expansion was successfull ***
  98.  
  99.    rem Call 'extra' file, allowing e.g. addition of banners
  100.  
  101.       command /cu2_xtra
  102.  
  103.    rem Create second check file to notify complete success to UC
  104.  
  105.       echo check > u$~chk2
  106.  
  107.  
  108. :end
  109. rem *** End of batchfile ***
  110.