@echo off
SET ABS_WEBSERVERHOME=%1
if exist %ABS_WEBSERVERHOME%\bin\*.log del /s /q %ABS_WEBSERVERHOME%\bin\*.log
del /s /f /q %ABS_WEBSERVERHOME%\logs
del /s /f /q %ABS_WEBSERVERHOME%\temp
if exist %ABS_WEBSERVERHOME%\webapps\*.war del /s /f /q %ABS_WEBSERVERHOME%\webapps\*.war

for /F "delims=" %%i in ('dir /b %ABS_WEBSERVERHOME%\work') do rmdir "%ABS_WEBSERVERHOME%\work\%%i" /s/q

for /F "delims=" %%i in ('dir /b %ABS_WEBSERVERHOME%\webapps') do (
  if NOT "%%i"=="docs" (
    if NOT "%%i"=="host-manager" (
      if NOT "%%i"=="manager" (
        if NOT "%%i"=="ROOT" rmdir "%ABS_WEBSERVERHOME%\webapps\%%i" /s/q
      )
    )
  )
)

if EXIST %ABS_WEBSERVERHOME%\wtpwebapps (
  rmdir "%ABS_WEBSERVERHOME%\wtpwebapps" /s/q
)

echo Finished cleaning up %ABS_WEBSERVERHOME% folder.
pause