Цитата oleg-sm:
а проще способа случайно нет? ) »
|
Царская дорога как метафора
.
Не переживайте, не боги горшки обжигают. Учиться никогда не поздно.
Цитата oleg-sm:
проверил, работает, только выдает ошибку в строке 16 символ 5 - файл уже существует »
|
Это «.CreateFolder strPath». Будем создавать папку только тогда, когда она не существует:
читать дальше »
Код:

Option Explicit
Dim strNewFolder
Dim strShare
Dim strPath
strNewFolder = Trim(InputBox("Input new folder name", "Input folder name", "New folder"))
If Len(strNewFolder) <> 0 Then
With WScript.CreateObject("Scripting.FileSystemObject")
For Each strShare In Array("\\192.168.10.20\new", "\\192.168.10.30\new2")
If .FolderExists(strShare) Then
strPath = .BuildPath(strShare, strNewFolder)
If Not .FolderExists(strPath) Then
.CreateFolder strPath
End If
.CopyFile "C:\newfile\bsv\list.txt", strPath & "\", True
Else
WScript.Echo "Can't find share [" & strShare & "]."
End If
Next
End With
Else
' Nothing input
End If
WScript.Quit 0