I have this script and I am getting an error when trying to move the folders to the new location...anyone have any suggestions?
'================================================
'Option Explicit
'On Error Resume next
Dim objNetwork
Dim objFso
Dim objFolder
Dim FromShare
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
FromShare = "N:\Origin\*"
DepToShare = "N:\Destination\"
If objFso.FolderExists(FromShare) Then
Wscript.Echo("Original folders" & VbCrLf & FromShare & VbCrLf & "exist")
End IF
If objFso.FolderExists(DepToShare) Then
'DepToShare = "Destination"
Wscript.Echo("Here is the deposit folder" & VbCrLf & DepToShare)
Call DepotCopShare
Else
Wscript.Echo("This share is not valid")
End if
Set ObjFso = Nothing
Sub DepotCopShare
set objFso = CreateObject("Scripting.FileSystemObject")
Wscript.echo("Deposit folder is valid...")
'This portion of the code is where I get the "Invalid Procedure call or argument"
objFso.CopyFolder FromShare, DepToShare, OverWriteFiles
End Sub
'=================================================
Any help is greatly appreciated.
'================================================
'Option Explicit
'On Error Resume next
Dim objNetwork
Dim objFso
Dim objFolder
Dim FromShare
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")
FromShare = "N:\Origin\*"
DepToShare = "N:\Destination\"
If objFso.FolderExists(FromShare) Then
Wscript.Echo("Original folders" & VbCrLf & FromShare & VbCrLf & "exist")
End IF
If objFso.FolderExists(DepToShare) Then
'DepToShare = "Destination"
Wscript.Echo("Here is the deposit folder" & VbCrLf & DepToShare)
Call DepotCopShare
Else
Wscript.Echo("This share is not valid")
End if
Set ObjFso = Nothing
Sub DepotCopShare
set objFso = CreateObject("Scripting.FileSystemObject")
Wscript.echo("Deposit folder is valid...")
'This portion of the code is where I get the "Invalid Procedure call or argument"
objFso.CopyFolder FromShare, DepToShare, OverWriteFiles
End Sub
'=================================================
Any help is greatly appreciated.