2
"XX"로 시작하는 모든 파일을 복사하려면이 스크립트를 가져 오려고합니다. 현재는 하나의 파일 만 복사합니다.시작 문자를 기준으로 VBScript 복사 파일
Dim objFSO, colFiles, objFile, strDestFolder, objNewestFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colFiles = objFSO.GetFolder("C:\source")
strDestFolder = "C:\destination\"
For Each objFile In colFiles.Files
If Left(objFile.Name, 2) = "XX" Then
If objNewestFile = "" Then
Set objNewestFile = objFile
Else
If objNewestFile.DateLastModified < objFile.DateLastModified Then
Set objNewestFile = objFile
End If
End If
End If
Next
If Not objNewestFile Is Nothing Then
objFSO.CopyFile objNewestFile.Path,strDestFolder,True
End If
WScript.Echo "Copied."
당신은 루프 밖에서'CopyFile'을하고, 그래서 마지막'objNewestFile' –