@echo off & setlocal enableextensions

:: watsbf.bat. Revised 19/3/2019. M.J. Dallwitz.

if "%1" equ "/?" (
   echo.
   echo Generates 'items' file for Watson subfamilies in folder 'grass-watsbf'.
   echo Copies specss, chars, etc. from 'grass' to 'grass-watsbf.
   exit /b 0
   )

set d=grass-watsbf

if not exist ..\%d%\ md ..\%d%

echo.
intkey5 -a intkey.ink -p=watsbf.inp
if errorlevel 1 goto abort
echo 'items' created.
echo.

:: Avoid prompting when copying specss.
xcopy /y specs ..\%d%\ > nul
if errorlevel 1 goto abort
xcopy /y specss ..\%d%\specs > nul
if errorlevel 1 goto abort
echo 'specss' copied.
xcopy /y chars ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'chars' copied.
xcopy /y charsi ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'charsi' copied.

echo.
xcopy /y cimages ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'cimages' copied.
xcopy /y cnotes ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'cnotes' copied.
xcopy /y headc ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'headc' copied.
xcopy /y layout ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'layout' copied.
xcopy /y newpar ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'newpar' copied.
xcopy /y ofiles ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'ofiles' copied.

echo.
xcopy /y ack.htm ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'ack.htm' copied.
xcopy /y contacts.htm ..\%d%\ > nul
if errorlevel 1 goto abort
xcopy /y hints.htm ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'hints.htm' copied.
echo 'contacts.htm' copied.
xcopy /y refs.htm ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'refs.htm' copied.
xcopy /y sample.htm ..\%d%\ > nul
if errorlevel 1 goto abort
echo 'sample.htm' copied.

goto end

:abort
echo Program aborted.
exit /b 1

:end
exit /b 0
