|
|
|||||||
Long time since I posted but could use some help. This script works using FindFile() and DirWalker() but of course I would like to improve it. The script creates a file by match from the UNC.csv and the name of the folder which is the computer name($FOLDER). How I would like to improve this script is there may be more folders in the location than in the UNC.csv and write the unmatched folders to a different file. Secondly, if the computer name is the UNC.csv but no mtach is found I would like it to be included the ROBO.csv with a blank $DLM. The path below is a sample of the robocopy.log path. There are 368 UNC distributed throughout the 12 org folders. \\Server\Shares$\Org\UNC\robocopy.log Code: Break On $path = "\\Server\Files$\" If Exist($Path + "ROBO.csv") = 1 DEL($Path + "ROBO.csv") EndIf $MATCH = "*.log" $FOLDER = "\\server\shares$" $Array = FindFile($MATCH,1,$FOLDER) $line = "Flight" + "," + "WWID" + "," + "Computer Name" + "," + "Last Update" +@CRLF If Open(3,$Path + "UNC.csv") = 0 $x = ReadLine(3) While @ERROR = 0 $WWID = Left($x,InSTR($x,",")-1) $UNC = Right($x,Len($x) - Len(Left($x,InSTR($x,",")))) For Each $Filename In $Array $firsthash = Left($filename,InStrRev($filename,"\")-1) $secHash = Left($firsthash,InStrRev($firsthash,"\")-1) $ETOOL = Right($firstHash,Len($firsthash)-Len(Left($firsthash,InStrRev($firsthash,"\")))) $Flight = Right($SecHash,Len(Left($firsthash,InStrRev($firsthash,"\")-1))-Len(Left($sechash,InStrRev($sechash,"\")))) $WWID = Left($x,InSTR($x,",")-1) $UNC = Right($x,Len($x) - Len(Left($x,InSTR($x,",")))) $UNC = Right($unc,len($unc) - Len(Left($unc,InSTR($unc,",")))) $UNC = Left($unc,instr($unc,",")-1) $objFSO = CreateObject("Scripting.FileSystemObject") $objFile = $objFSO.GetFile($FileName) $DLM = $objFile.DateLastModified $DLM= Left($DLM,10) If $UNC = $etool $line = $line + $flight + "," + $WWID + "," + $etool + "," + $DLM + @CRLF EndIf Next $x = ReadLine(3) Loop Close(3) EndIf Jay in Japan |