@ echo off
if not exist ..\bin\apclient.bin.exe (echo. & echo ERROR: please execute this command from ^<IAHome^>\tools - exiting... & goto :finish)
if not exist .\zip.exe (echo. & echo ERROR: zip.exe was not found - exiting... & goto :finish)
echo Creating an archive of support materials for the xMatters Integration Agent...
setlocal
set d=%date:~-10%
set d=%d:/=-%
set t=%time:~,8%
set t=%t::=-%
set t=%t: =%

rem We need to move to the parent folder, since the zip utility can't deal with "..\" in its list of files.
pushd ..
tools\zip.exe -r %temp%\xmatters-ia-support-%d%-%t%.zip * -i conf\* integrationservices\* log\*.txt bin\logs\* lib\integrationservices\javascript\*.js lib\*util*.jar
move %temp%\xmatters-ia-support-%d%-%t%.zip log\. >nul
popd
echo.
echo The archive can be found at ^<IAHome^>\log\xmatters-ia-support-%d%-%t%.zip

:finish
