REM ============================================
REM Script: process_webhooks.bat
REM Last Changed: $Id$
REM Usage: Run from /CUST/XXXX/Exchange folder using:
REM        CALL ..\..\..\utils\Exchange\process_webhooks.bat
REM ============================================

REM Set mstamp to today's date in yyyymmdd format
for /f "tokens=2,3,4 delims=- " %%a in ('echo %date%') do set "mstamp=%%c%%b"

REM Get customer name from parent folder
for %%a in ("%cd%\..\.") do set "cust=%%~nxa"

REM Define temporary log path
set "exchtemp=..\..\..\TEMP\%cust%\Exchange"

REM Create directory if it doesn't exist
if not exist "%exchtemp%" (
    mkdir "%exchtemp%"
)

REM Run the webhook processing script and log output
cscript ..\..\..\UTILS\Exchange\process_webhooks.wsf >>"%exchtemp%\%~n0_%mstamp%.log" 2>>&1
