@echo off
:--------------------------------------------------------------------------
: RXP.BAT
:--------------------------------------------------------------------------
: Batch file for Outside File Decompression/Compression with Silver Xpress.
:                  (c) copyright 1988-90 by Santronics Software
:--------------------------------------------------------------------------
:  NOTE: This batch file is customized for PKZIP and PKUNZIP
:        It assumes the default work directory is used.
:--------------------------------------------------------------------------
if not '%1' == '' goto  start
:
   echo ------------------------------------------------
   echo usage:  RXP xpress_packet_name
   echo         No extension is required
   echo ------------------------------------------------
   echo ---- Available Xpress files -----
     if exist *.op? lf *.op?
     echo > nul
   echo ---- Available Reply Packets ----
     if exist *.rep lf *.rep
     echo > nul
   goto end
:
:start
:
: make work directory and start decompression of packet.
:
  if  exist %1.opx goto ok1
  echo %1 packet does not exist
  goto end
:ok1
  md $work$.dir
  echo  Opening up mail packet....
  cd $work$.dir
  PKUNZIP -o ..\%1.opx > nul
  cd ..
  if not exist %1.rep goto ok4
  Echo  A reply Packet exist !
  AskYN Delete this REPLY packet "%1.REP"? Y/N  20 10
  if errorlevel 20 goto ok2
  if errorlevel 10 goto ok3
  goto ok4
:ok2
  erase %1.rep
  echo  Reply %1.rep packet deleted.
  goto ok4
:ok3
  Echo  Unpacking Current Reply Packet....
  cd $work$.dir
  PKUNZIP -o ..\%1.rep > nul
  cd ..
:ok4
: YOU MUST BE IN THE STARTUP DIRECTORY. XPRESS WILL CHANGE TO $WORK$
  xpread -O%1.opx
: XPRESS WILL RETURN TO THE STARUP DIRECTORY
  if not exist $work$.dir\!*.* goto cleanup
  echo  Creating a reply packet.....
  if exist %1.rep erase %1.rep
  PKZIP -meb4 %1.rep $work$.dir\!*.* $work$.dir\*.ID > nul
:cleanup
  echo  Cleaning up work directory!
  echo Y | erase $work$.dir\*.* > nul
  rmdir $work$.dir
:
:end

