@Echo off
 REM ===========================================================================
 REM JobMgr Nativ.Rf.Script for Customer (c)addPLM 2006..2017
 REM Date/Time  Name   Details:
 REM 26.12.2016 J.Fes  first version
 REM ===========================================================================
 
 Call Echo "**************************************************************************"
 Call Echo "* Excuting Native Refile Script for NX  PLMJobManager Environ            *"
 Call Echo "* Version: V3.3  (c)addPLM GmbH  26.12.2017                              *"
 Call Echo "**************************************************************************"

 rem -- am Anfang Farbe auf IsIdel setzen
 call ColorSet "IsExecuting"

 REM -- define incudes #New: 05.07.2016/J.Fes
 set JobMgr_10-JobScriptsInc_01=_JobMgrDefaults
 set JobMgr_10-JobScriptsInc_02=_CustomDefaults\NXPrompt

 REM -- #Doc: Inits all Basics of Job
 Call "%~dp0_JobInitial.cmd" "Refile Native" "YES" "NO" "NO" "NO"

 set titleTxt=Rf:[%JobName%][%TcSiteId%][%Date% %time:~0,5%][\\%ComputerName%]
 title %titleTxt%

 set NXPrompt_Custom_DPNE=%CmdCurRoot_DP%\NxPrompt_Custom.cmd
 if exist "%NXPrompt_Custom_DPNE%" call "%NXPrompt_Custom_DPNE%"
 set RfParam=%JobParameter%
 if "%JobMgr_NXPromptGet_ResCode%" equ "0" Call "%CmdCurRoot_DP%\RfExecute.cmd"


 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 #New: 26.12.2017/J.Fes
  Call Echo "----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----"
  Call Echo "CleanUp.........................: %CmdCurRoot_DP%\startup\.."
  rd /S /Q "%CmdCurRoot_DP%\startup"
  Call Echo "CleanUp.........................: %CmdCurRoot_DP%\Resources\.."
  rd /S /Q "%CmdCurRoot_DP%\Resources"
  del /S /Q "%CmdCurRoot_DP%\*.prt","%CmdCurRoot_DP%\*.tmp"

  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
goto :end

REM ============================================================================
:end
 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"
 EXIT /B 0

