2024-06-03
This commit is contained in:
93
port/file-sp101-139.md
Normal file
93
port/file-sp101-139.md
Normal file
@ -0,0 +1,93 @@
|
||||
---
|
||||
type: "port"
|
||||
assigned: ""
|
||||
physical-address: "00:10:6F:00:D7:4E"
|
||||
namespace: "MET08DDUPSP1TBI"
|
||||
created: "2024-01-06T01:25:36.253Z"
|
||||
updated: "2024-01-06T01:25:36.253Z"
|
||||
---
|
||||
|
||||
# file-sp101-139
|
||||
|
||||
- [ ] [file](\\10.95.154.12\Testdata)
|
||||
|
||||
```bat
|
||||
@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
|
||||
```
|
||||
|
||||
```vba
|
||||
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()
|
||||
```
|
Reference in New Issue
Block a user