@echo off
rem ********************************************
rem **                                        **
rem **             UpConv.Bat                 **
rem **                                        **
rem **      Copyright Peter Davies 1994       **
rem **        All Rights Reserved             **
rem **                                        **
rem **        For use with Ezycom Only        **
rem **                                        **
rem ********************************************
echo Converting *  %5.%7 to %5.%6  *
echo Testing %5.%7 for Integrity

rem If called stand alone, it checks to see if enough parameters were
rem passed to the batch file

if !%6! == !! goto endit

rem This is a list of the command line in upconv.bat and doconv.bat (Ezycom)

rem %1 1                         node number
rem %2 C:\EZY\SECUPLD\           where uploaded
rem %3 C:\EZY\TEMP\CONV01        where it does it
rem %4 C:                        drive it is on
rem %5 LIST                      file name no ext
rem %6 ZIP                       ext to
rem %7 ARJ                       ext from (could be NULL)

:start
if exist %3\*.* goto :del

%4
md %3
cd %3

if %7 == TXT goto moveit
if %7 == DOC goto moveit
if %7 == LST goto moveit
if %7 == PAS goto moveit
if %7 == C   goto moveit
FOR %%A IN (LZH ZIP ARC PAK SDN ZOO ARJ SQZ COM EXE) DO IF %%A == %7 GOTO WAS%7
goto :finish

:moveit
copy %2%5.%7 %3
goto now%6

:del
attrib -A -S -H -R %3\*.*
echo Y | del %3\*.*
rd  %3
goto start

:waszip
pkunzip -o %2%5.%7
rem Bad Zip
if errorlevel 51 goto dodel
rem Disk Full
if errorlevel 50 goto finish
rem Bad Zip
if errorlevel  9 goto dodel
rem Not Enough Memory
if errorlevel  4 goto finish
rem Bad Zip
if errorlevel  1 goto dodel
rem Zip OK
goto scan

:waslzh
lha e /cnm %2%5.%7
if errorlevel 1 goto dodel
goto scan
                    
:wasarc
PKXARC -r %2%5.%7
if errorlevel 1 goto dodel
goto scan

:wassdn
:waspak
PAK e /wa %2%5.%7
if errorlevel 1 goto dodel
goto scan

:wassdn
:wasarj
arj e -y %2%5.%7
rem *** Bad ARJ
if errorlevel 9 goto dodel
rem *** Not enough Memory
if errorlevel 8 goto finish
rem *** Bad ARJ
if errorlevel 6 goto dodel
rem *** Disk Full
if errorlevel 5 goto finish
rem *** Bad ARJ
if errorlevel 1 goto dodel
goto scan

:waszoo
ZOO -e %2%5.%7
if errorlevel 1 goto dodel
goto scan

:wassqz
SQZ x /o1 %2%5.%7
if errorlevel 1 goto dodel
goto scan

:wascom
:wasexe
copy %2%5.%7 %3
:rem scan /NOMEM %3
E:\TBAV\TBSCAN ignofile %3
if errorlevel 1 goto dodel
goto finish

:dodel
echo Deleting %2%5.%7 A Virus or Bad Archive
del %2%5.%7
goto finish

:scan
if exist ..\FILE_ID.%1 del ..\FILE_ID.%1
if exist FILE_ID.DIZ copy FILE_ID.DIZ ..\FILE_ID.%1
SCAN /NOMEM %3
if errorlevel 1 goto dodel
goto now%6

:nowzip
if exist %2%5.%7 del %2%5.%7
cd \
pkzip -o %2%5 %3\*.*
rem *** To add an archive comment use the following command
rem *** pkzip -z %2%5 <c:\path\comment.txt
goto finish

:nowlzh
if exist %2%5.%7 del %2%5.%7
cd \
lha a -tm %2%5 %3\*.*
goto finish

:nowarc
if exist %2%5.%7 del %2%5.%7
cd \
pkarc -oct -a %2%5 %3\*.*
goto finish

:nowpak
if exist %2%5.%7 del %2%5.%7
cd \
pak A /O /WA /L %2%5 %3\*.*
goto finish

:nowarj
if exist %2%5.%7 del %2%5.%7
if exist %2%5.%6 del %2%5.%6
cd \
arj m -ey -jm1 %2%5 %3\*.* -ze:\ezycom\header.txt
rem *** To add an archive comment use the following command
rem *** arj c -zc:\path\comment.txt %2%5
goto finish

:nowzoo
if exist %2%5.%7 del %2%5.%7
cd \
zoo -a %2%5 %3\*.*
goto finish

:nowsqz
if exist %2%5.%7 del %2%5.%7
cd \
sqz a /m4 /q0 %2%5 %3\*.*
goto finish

:finish
cd \
attrib -A -S -H -R %3\*.*
echo Y | del %3\*.*
rd %3
:ENDIT

