robo108/SCANFILE.BAT

5.7 KB df433c61fc49a510…
@ECHO OFF

	cls

REM
REM NOTE:
REM
REM Unlike in the manual this version  of the Batch
REM file does not SCAN or add a BBSADD. If you have
REM either file then  UN-REM the  appropriate lines
REM in the following Batch.
REM

REM
REM ---------------- WHAT IT DOES ------------------
REM  
REM  This batch file as it is set up at the moment
REM  controls Virus scanning, Type Conversion,
REM  adding a BBS add, and deleting unwanted files.
REM
REM  This example assumes you have:
REM    PKUNZIP.EXE    By PKWARE Inc.
REM    LHA.EXE        By Haruyasu Yoshizaki
REM    PKUNPAK.EXE    By PKWARE Inc.
REM    ARJ.EXE        By Robert K. Jung
REM    SCAN.EXE       By David MacAfee
REM    BBSADD.TXT     By YOU (A text file to
REM                   advertise your BBS)
REM
REM ----------------- THE PROCESS ------------------
REM
REM  During the conversion process in Robo-Board this
REM  Batch file  will decompress  the  given file to
REM  the work  directory  created by  Robo-Board. At
REM  this point we can add files to it, scan it, and
REM  delete files  from it.  After this is done, the
REM  batch file will either "OK" the file and return
REM  a new file  name to  Robo-Board or  return that
REM  the file was not successful. 
REM
REM  A Return is  name given to  Robo-Board via  the 
REM  file RETURN.NAM.  This file  is deleted  before 
REM  this batch  file is  run and  must  exist  upon 
REM  return to Robo-Board or the uploaded  file will 
REM  be not be "OKed".  If  RETURN.NAM contains  the  
REM  words "BAD SCAN" the file  is also  not "OKed". 
REM
REM ------- THE VARIABLES USED IN THIS BATCH -------
REM
REM  %1 = This NUMBER, representing the File type to 
REM       convert is taken from  FILEVIEW.DEF  so be 
REM       sure  the   entries  in  FILEVIEW.DEF  are
REM       numbered to correspond with your batch.
REM       eg:   1=LZH 2=ZIP 3=PAK 4=ARC 5=ARJ
REM  %2 = Original file with full path (no ext)
REM  %3 = Destination file with full path (no ext)
REM  %4 = File name with no extension
REM  %5 = Work directory no trailing "\"
REM  %6 = Baud rate. Locked buad rate if locking.
REM  %7 = Com Port (1-8)
REM        

	if "%1"=="" goto ERROR
	if "%2"=="" goto ERROR
	if "%3"=="" goto ERROR
	if "%4"=="" goto ERROR
	if "%5"=="" goto ERROR
	
	echo.
	echo ----------------------------------------------
	echo   BAUD RATE     : %6
	echo   COM PORT      : %7
	echo   ORIGINAL FILE : %2
	echo   NEW FILE      : %3
	echo   WORK DIR      : %5
	if "%1"=="1" echo   PROCESSING    : %4.LZH file
	if "%1"=="2" echo   PROCESSING    : %4.ZIP file
	if "%1"=="3" echo   PROCESSING    : %4.PAK file
	if "%1"=="4" echo   PROCESSING    : %4.ARC file
	if "%1"=="5" echo   PROCESSING    : %4.ARJ file

	if "%1"=="1" goto LZH2ARJ
	if "%1"=="2" goto ZIP2ARJ
	if "%1"=="3" goto PAK2ARJ
	if "%1"=="4" goto ARC2ARJ
	if "%1"=="5" goto ARJ2ARJ
       
	goto DONE

REM
REM THE FOLLING DESCRIBES THE SCAN/CONVERT PROCESS
REM
REM 1) EXTRACT OLD FILE TO WORK DIRECTORY
REM 2) DELETE OLD ARCHIVE FILE
REM 3) VIRUS SCANNER (Assuming SCANV series)        
REM 4) DELTE ANY OTHER BBS ADDS YOU MAY KNOW OF.
REM 5) IF VIRUS SCANNER RETURNS A BADSCAN GOTO BADSCAN
REM 6) BBS ADD FILE  (Assuming BBSADD.TXT name)        
REM 7) CREATE NEW ARCHIVE FILE (ARJ assumed)        
REM 8) PLACE NAME OF NEW FILE IN FILE RETURN.NAM
REM 9) GOTO DONE

:LZH2ARJ
	lha       E %2 %5\     
	del       %2.LZH
        scan /nomem /noexpire  %5\*.*
        if errorlevel 1 goto BADSCAN
	del       %5\BBSADD.TXT
	del       %5\*.ADD
        copy      BBSADD.TXT %5
        pkzip      -ex %3 %5\*.*
        echo      %4.ZIP > RETURN.NAM
	goto      Done

:ZIP2ARJ
	PKUNZIP   %2 %5\     
	del       %2.ZIP
        scan /nomem /noexpire  %5\*.*
        if errorlevel 1 goto BADSCAN
	del       %5\BBSADD.TXT
	del       %5\*.ADD
        copy      BBSADD.TXT %5
        pkzip     -ex %3 %5\*.*
        echo      %4.ZIP > RETURN.NAM
	goto      Done

:PAK2ARJ
	pkunpak   %2 %5\     
	del       %2.PAK
        scan /nomem /noexpire  %5\*.*
        if errorlevel 1 goto BADSCAN
	del       %5\BBSADD.TXT
	del       %5\*.ADD
        copy      BBSADD.TXT %5
        pkzip     -ex %3 %5\*.*
        echo      %4.ZIP > RETURN.NAM
	goto      Done

:ARC2ARJ
	pkunpak   %2 %5\     
	del       %2.ARC
        scan /nomem /noexpire  %5\*.*
        if errorlevel 1 goto BADSCAN
	del       %5\BBSADD.TXT
	del       %5\*.ADD
        copy      BBSADD.TXT %5
        pkzip     -ex %3 %5\*.*
        echo      %4.ZIP > RETURN.NAM
	goto      Done

:ARJ2ARJ
	ARJ       E -y %2 %5\     
	del       %2.ARJ
        scan /nomem /noexpire  %5\*.*
        if errorlevel 1 goto BADSCAN
	del       %5\BBSADD.TXT
	del       %5\*.ADD
        copy      BBSADD.TXT %5
        pkzip     -ex %3 %5\*.*
        echo      %4.ZIP > RETURN.NAM
	goto      Done

:BADSCAN
	echo BAD SCAN > RETURN.NAM
	echo.
	echo File did not pass scan
REM
REM     We cannot delete *.* in a batch file because
REM     of that annoying (Y/N) prompt dos now has. So
REM     we have to move the contents  to one file and
REM     delete that file.
REM
	Echo Y | Del %5\*.*
	goto      Done

:ERROR
	echo.
	echo ----------------------------------------------
	echo Processing NOTHING (Fields 1-7 must be filled)
	echo ----------------------------------------------
	echo   1 = # representing the file type to convert
	echo   2 = Original file with full path
	echo   3 = Destination file with full path
	echo   4 = File name with no extension
	echo   5 = Work directory no trailing "\"
	echo   6 = Baud rate. Locked buad rate if locking
	echo   7 = Com Port (1-8)
	echo ----------------------------------------------
:DONE
	echo.
	echo Exiting...
	echo.