Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Procedure call or argument error for objFso.CopyFolder

Status
Not open for further replies.

chadbi

IS-IT--Management
Nov 24, 2008
14
US
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.
 
Well, just for starters I don't see anywhere that you define OverWriteFiles.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
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. Anyone know what am I missing to accomplish this?
 
What about this ?
objFso.CopyFolder FromShare, DepToShare, True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top