.ec-documentation/port/file-sp101-139.md
2024-06-03 07:17:41 -07:00

2.1 KiB

type, assigned, physical-address, namespace, created, updated
type assigned physical-address namespace created updated
port 00:10:6F:00:D7:4E MET08DDUPSP1TBI 2024-01-06T01:25:36.253Z 2024-01-06T01:25:36.253Z

file-sp101-139

@ECHO ON

:start

xcopy z:\*.txt y:\RawData\SP1
xcopy z:\*.prn y:\RawData\SP1
del z:\*.txt
del z:\*.prn

ping /n 1 /w 2000 localhost >nul

goto start
Option Explicit

Const sLocal = "C:\Tmp\SP1"
Const sWin2008 = "\\10.95.1.211\Share"
Const sSource = "\\10.95.154.12\testdata"

Dim oFile
Dim oFileLog
Dim oFiles
Dim oFolder
Dim oFSO
Dim sErrMsg

Set oFSO = CreateObject("Scripting.FileSystemObject")

sErrMsg = ""

On Error Resume Next

Set oFiles = oFSO.GetFolder(sSource).Files

If Err.Number <> 0 Then
    sErrMsg = Err.Description
Else
    For Each oFile In oFiles
        If LCase(Right(oFile.Name, 4)) = ".txt" OR LCase(Right(oFile.Name, 4)) = ".prn" Then
            Call oFSO.MoveFile(sSource & "\" & oFile.Name, sLocal & "\" & oFile.Name)
            If Err.Number <> 0 Then
                sErrMsg = Err.Description
                Exit For
            End If
            Set oFile = Nothing
        End If
    Next
End If
Set oFiles = Nothing
Set oFolder = oFSO.GetFolder(sLocal)
For Each oFile In oFolder.Files
    If LCase(Right(oFile.Name, 4)) = ".txt" OR LCase(Right(oFile.Name, 4)) = ".prn" Then
        Call oFSO.CopyFile(sLocal & "\" & oFile.Name, sWin2008 & "\" & oFile.Name, True)
        Call oFSO.DeleteFile(sLocal & "\" & oFile.Name)
    End If
Next
If Len(sErrMsg) = 0 Then
    sErrMsg = "Move OK"
Else
    sErrMsg = "Error moving file: Err.Number = " & Err.Number & " ; Err.Description = " & Err.Description
    Call MsgBox(sErrMsg)
    Call MsgBox("Suggestion:  Click on the MOCVD drive and make sure it does not prompt for Labman password")
End If
If Len(sErrMsg) > 0 Then
    Set oFileLog = oFSO.OpenTextFile("C:\Log_File_Copy\SP1.txt", 8, True)
    Call oFileLog.WriteLine(CStr(Now) & " " & sErrMsg)
    Call oFileLog.Close()
    Set oFileLog = Nothing
End If

Call MsgBox("Exit")

Set oFile = Nothing
Set oFolder = Nothing
Set oFSO = Nothing
WScript.quit()