使用 VBScript 递归文件和文件夹检查复制的项目到新目标

时间:2021-04-19 13:57:57

标签: vbscript

我有一个脚本,我刚刚放在一起,用于将整个文件夹、其子文件夹和文件复制到新目标。我想要实现的是验证每个文件副本,因为它复制它是否通过文件大小,md5 对我来说并不重要。我只想确保在移动到下一个文件之前复制每个文件 100%,并可能将输出通过管道传输到文本文件。下面的代码是我到目前为止所拥有的代码,我只是不知道如何继续。

On Error Resume Next
Dim objShell, objSMPDriversSource, objLibrarySource, objSMPDriversDest, objLibraryDest, FSO, F
set objShell = WScript.CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set F = FSO.CreateTextFile("C:\Users\Dummy\Desktop\replication_log.txt", True)

'Stop Symantec Management Agent & World Wide Web Publishing Service - Services
objShell.run("net stop ""Symantec Management Agent""")
objShell.run("net stop ""World Wide Web Publishing Service""")

'Begin Copy of SMP Drivers & Library
objSMPDriversSource = "D:\SMPDrivers"
objSMPDriversDest = "D:\seed_backup\SMPDrivers"
objLibrarySource = "D:\LIBRARY"
objLibraryDest = "D:\seed_backup\LIBRARY"

FSO.CopyFolder objSMPDriversSource, objSMPDriversDest
'FSO.CopyFolder objLibrarySource, objLibraryDest

If Err.Number = 0 Then
F.WriteLine "File Copy Problem: " & err.number, err.description
End If

If FSO.FileExists(objSMPDriversDest) Then
F.WriteLine "File Copied"
End If

F.Close

'Start Symantec Management Agent & World Wide Web Publishing Service - Services
objShell.run("net start ""Symantec Management Agent""")
objShell.run("net start ""World Wide Web Publishing Service""")

0 个答案:

没有答案