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

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

if !%5! == !! goto endit

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

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

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

%3
md %2
cd %2

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

:moveit
copy %1%4.%6 %2
goto now%5

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

:waszip
cd %2
pkunzip -o %1%4.%6
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
cd %2
lha e /cnm %1%4.%6
if errorlevel 1 goto dodel
goto scan
                    
:wasarc
cd %2
PKXARC -r %1%4.%6
if errorlevel 1 goto dodel
goto scan

:wassdn
:waspak
cd %2
PAK e /wa %1%4.%6
if errorlevel 1 goto dodel
goto scan

:wasarj
cd %2
arj e -y %1%4.%6
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
cd %2
ZOO -e %1%4.%6
if errorlevel 1 goto dodel
goto scan

:wassqz
cd %2
SQZ x /o1 %1%4.%6
if errorlevel 1 goto dodel
goto scan

:wascom
:wasexe
copy %1%4.%6 %2
scan /NOMEM %2
if errorlevel 1 goto dodel
goto finish

:dodel
echo Deleting %1%4.%6 A Virus or Bad Archive
del %1%4.%6
goto finish

:scan
cd \
SCAN /NOMEM %2
if errorlevel 1 goto dodel
goto now%6

:nowzip
if exist %1%4.%6 del %1%4.%6
cd \
pkzip -mo %1%4 %2\*.*
goto finish

:nowlzh
if exist %1%4.%6 del %1%4.%6
cd \
lha a -tm %1%4 %2\*.*
goto finish

:nowarc
if exist %1%4.%6 del %1%4.%6
cd \
pkarc -oct -a %1%4 %2\*.*
goto finish

:nowpak
if exist %1%4.%6 del %1%4.%6
cd \
pak A /O /WA /L %1%4 %2\*.*
goto finish

:nowarj
if exist %1%4.%6 del %1%4.%6
cd \
arj a -ey %1%4 %2\*.*
goto finish

:nowzoo
if exist %1%4.%6 del %1%4.%6
cd \
zoo -a %1%4 %2\*.*
goto finish

:nowsqz
if exist %1%4.%6 del %1%4.%6
cd \
sqz a /m4 /q0
goto finish

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

