Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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 nextDim objNetwork
Dim objFso
Dim objFolder
Dim FromShareSet 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 IFIf 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 ifSet 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, OverWriteFilesEnd Sub
'=================================================
Any help is greatly appreciated.

What you posted works. Presumably you changed FromShare and DepToShare before posting it. I suggest double checking the real values, to ensure they're both valid paths.
Also, OverWriteFiles is never declared, so its value is False.

I will omit the OverWriteFiles declaration...the problem seems to be that I am trying to copy over a set of subfolders to the N:\Origin\ folder. What am I missing to accomplish this?

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |