@if NOT EXIST setup.bat goto ERR1
call setup
call mdd temp
@if NOT EXIST ..\exclude.bat goto ERR2

@set TEMPa=archive.tar

md dir
echo blues > dir\blues
echo jazz > dir\jazz
md dir\folk
echo tagfile > dir\folk\tagfile
echo sanjuan > dir\folk\sanjuan
md dir\rock
echo Signature: 8a477f597d28d172789f06886806bc55 > dir\rock\CACHEDIR.TAG
echo "test" > dir\rock\file
@if NOT EXIST dir\blues goto ERR3
@if NOT EXIST dir\jazz goto ERR3
@if NOT EXIST dir\rock\CACHEDIR.TAG goto ERR3

@for %%i in (exclude-caches exclude-caches-under exclude-caches-all) do @(call :DOEX1 %%i)

@for %%i in (exclude-tag exclude-tag-under exclude-tag-all) do @(call :DOEX2 %%i) 

@cd ..
@goto END


:DOEX1
@if "%1x" == "x" goto :EOF
@set TEMPO=%1
@echo OPTION = %TEMPO%
%TEMPT% -cf %TEMPA% --%TEMPO% -v dir 2> temp.err
@echo ARCHIVE LIST
%TEMPT% tf %TEMPA%
@echo OPTION = %TEMPO% - any tar error follows ...
type temp.err
@echo In each case there should be record not dumped ...
@pause
@if EXIST %TEMPA% del %TEMPA% > nul
@goto :EOF

:DOEX2
@if "%1x" == "x" goto :EOF
@set TEMPO=%1
@echo OPTION = %TEMPO%
%TEMPT% -cf %TEMPA% --%TEMPO%=tagfile -v dir 2> temp.err
@echo ARCHIVE LIST
%TEMPT% tf %TEMPA%
@echo OPTION = %TEMPO% - any tar error follows ...
type temp.err
@echo In each case there should be record not dumped ...
@pause
@if EXIST %TEMPA% del %TEMPA% > nul
@goto :EOF

:ERR1
@echo Can NOT locate setup.bat ... check name, location ...
@goto END

:ERR2
@echo mdd.bat missing, or failed ... check name, location ...
@goto END

:ERR3
@echo Oops, something FAILED ...
@goto END

:END
