Тема: VBScript: Копирование файла с неизвестной буквой диска
Добрый день. Помогите понять, что я делаю не так?
On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
colDrives = Split("D E F G H I J K L M N O P Q R S T U V W X Y Z")
Set dictDrives = CreateObject("Scripting.Dictionary")
For Each Drive In colDrives
Set Drv = FSO.GetDrive(Drive & ":")
If Err.Number Then
dictDrives.Add Drive & ":", False
Else
If Drv.DriveType = 1 And Drv.IsReady Then
dictDrives.Add Drive & ":", True
Else
dictDrives.Add Drive & ":", False
End If
End If
Err.Clear
Next
' Бесконечный цикл
While True
For Each Drive In dictDrives.Keys
Set Drv = FSO.GetDrive(Drive)
If (Err.Number) Or (Drv.IsReady = False) Or (Drv.DriveType <> 1) Then
Flag = False
Else
Flag = True
End If
Err.Clear
Current = dictDrives.Item(Drive)
If Current <> Flag Then
If Current = False And Flag = True Then
Const OverwriteExisting = True
Set kopirovaniefaila = CreateObject("Scripting.FileSystemObject")
kopirovaniefaila.CopyFile "C:\FSO\ScriptLog.txt" , Drive + ":\Archive\", OverwriteExisting
WScript.Echo "Диск " & Drive & " был подключён."
Else
'
End If
dictDrives.Item(Drive) = Flag
End If
Next
WScript.Sleep 1000
WendВроде определяет, но никак не хочет копировать txt файл в папку Archive. Как я только не изголялся, не знаю я как правильно написать.

