$ListOfFiles = dirplus($TaskSource,"/a-d /s /m .log")
WriteLog("Retrieving list op log files on Belsrv0101")
FOR Each $File In $ListOfFiles
WriteLog("Processing TechDoc File " + $File,1)
WriteLog($Stars,1)
$NUL = OPEN (6, $File)
$CurrentFile = Readline(6)
$CurrentFile1 = ""
WHILE @ERROR = 0
$CurrentFile = Substr($CurrentFile,2, LEN($CurrentFile)-2)
IF (INSTRREV($CurrentFile, " ")) > 0
$CurrentFileHasSpace = 1
ENDIF
WriteLog("TechDocFile " + $CurrentFile,1)
IF (EXIST ("I:\Data\PRJ" + SUBSTR($CurrentFile,3)))
$CurrentFile1 = "I:\Data\PRJ" + SUBSTR($CurrentFile,3)
$CurrentFile2 = REPLACE ($CurrentFile,"Q:\","Z:\")
ENDIF
IF (EXIST ("H:\Data\PRJ" + SUBSTR($CurrentFile,3)))
$CurrentFile1 = "H:\Data\PRJ" + SUBSTR($CurrentFile,3)
$CurrentFile2 = REPLACE ($CurrentFile,"Q:\","Z:\")
ENDIF
IF (EXIST ($KSBE01_Prop + SUBSTR($CurrentFile,3)))
$CurrentFile1 = REPLACE ($CurrentFile,"O:","X:")
$CurrentFile2 = REPLACE ($CurrentFile,"O:","Y:")
ENDIF
IF LEN($CurrentFile1) < 2
WriteLog("***** Could not find source location " + $CurrentFile,1)
ENDIF
IF NOT EXIST($CurrentFile1)
WriteLog("***** Could not find source file " + $CurrentFile1 + " *****",1)
ELSE
IF NOT EXIST (SUBSTR($CurrentFile2,1,INSTRREV($CurrentFile2, "\")))
ChkDir2(SUBSTR($CurrentFile2,1,INSTRREV($CurrentFile2, "\")-1))
ENDIF
IF $CurrentFileHasSpace = 1
$CurrentFile1 = Chr(34) + $CurrentFile1 + Chr(34)
$CurrentFile2 = Chr(34) + $CurrentFile2 + Chr(34)
$CurrentFileHasSpace = 0
WriteLog("TechDocFile does contain space(s), adding quotes for copy" ,1)
ENDIF
WriteLog("COPY " + $CurrentFile1 + " " + $CurrentFile2,1)
COPY $CurrentFile1 $CurrentFile2
ENDIF
$CurrentFile = Readline(6)
LOOP
$NUL = CLOSE (6)
WriteLog("Moving " + $File + " to location " + $BELSRV0112_TD_FileCopy,1)
MOVE $File $BELSRV0112_TD_FileCopy
WriteLog($Stars,1)
$Start_TD2 = TimeValue("Start_TD2")
IF $Start_TD1 <> $Start_TD2
WriteLog( "Processing time file " + Cstr($File) + " => " + TimeDiff($Start_TD1,$Start_TD2),1)
ENDIF
$Start_TD1 = TimeValue("Start_TD1")
WriteLog($Stars,1)
NEXT