 REM -- #Doc: do all actions at end of Job
 REM -- #New: 27.12.2017J.Fes        first version
 REM    #LUp: 26.04.2018 23:31:02/J.Fes        Optimice
 REM -- Usage: Call "_JobFinish.cmd"

 REM -- #Step: Farbe setzen IsIdel
 call "%CmdCurRoot_DP%\ColorSet" "END"

 if /i "%JobMgr_Test%" neq "ON" goto :JumbOver
  Banner Test:End
  Call Echo "----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----"
  Call Echo "#TestMode.......................: End of Test"
  Call Echo "JobName.........................: %JobName%"
  pause
:JumbOver

  rem -- #Step: delete all files not to send to JobServer
  rem    #Doc: but not if JobMgr_Debug=ON
 if /i "%JobMgr_Debug%" equ "ON" goto :JumbOverCleanUp
  rem #New: 14/11/2014/J.Fes
  Call Echo "----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----"
  if not exist "%CmdCurRoot_DP%\startup" goto :Next
   Call Echo "CleanUp.........................: %CmdCurRoot_DP%\startup\.."
   rd /S /Q "%CmdCurRoot_DP%\startup"
  :Next
  if not exist "%CmdCurRoot_DP%\Resources" goto :Next
   Call Echo "CleanUp.........................: %CmdCurRoot_DP%\Resources\.."
   rd /S /Q "%CmdCurRoot_DP%\Resources"
  :Next

:JumbOverCleanUp

  del /S /Q "%CmdCurRoot_DP%\*.fscproxylog","%CmdCurRoot_DP%\*.rol_bin" >nul 1>nul 2>nul
  del /S /Q "%CmdCurRoot_DP%\*.cgm","%CmdCurRoot_DP%\*.prt","%CmdCurRoot_DP%\*.tmp","%CmdCurRoot_DP%\*.bak">nul 1>nul 2>nul

  rem #New:24/11/2014 J.Fes preventing sending big logfies to JobServer
  call robocopy "%CmdCurRoot_DP%" "%CmdCurRoot_DP%\..\_JobLogNotSendToJobServer\%JobName%" "*.*log*" /Move /S /MIN:3072000 /R:1 /W:1
  rem #New:7/21/2017 J.Fes Cleanup dir JobLogNotSendToJobServer
  call "%BinPublic_DP%\delage32.exe" "%CmdCurRoot_DP%\..\_JobLogNotSendToJobServer\*.*" 2 /modified /recurse /rd /includeRHS

 cd /d "%tempOrig_DP%"
 Call Echo "--------------------------------------------------------------------------"
 Call Echo "Info: all files in...............: %temp%"
 Call Echo "Info: will be zipt by JobClient..: and send to JobServer"


if /i "%JobMgr_Debug%" neq "ON" goto :JumbOverDebug
 call Echo "---------------------------------------------------------------------------"
 call Echo "#Debug End of ..................: %JobName%"
 pause
:JumbOverDebug
