@echo off
SET path=%cd%

if exist %path%\bin\*.log del /s /q %path%\bin\*.log

del /s /f /q %path%\logs
del /s /f /q %path%\temp
if exist %path%\webapps\*.war del /s /f /q %path%\webapps\*.war

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

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

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

echo Finished cleaning up %path% folder.
pause