Computing.Net > Forums > Programming > VBS .CopyFolder Error help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS .CopyFolder Error help

Reply to Message Icon

Name: chadbi
Date: December 10, 2008 at 09:11:00 Pacific
OS: Windows XP PRO SP2
CPU/Ram: 512 DDR
Product: Dell / GX270
Comment:

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.




Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: December 11, 2008 at 01:25:46 Pacific
Reply:

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.


0

Response Number 2
Name: chadbi
Date: December 11, 2008 at 06:40:17 Pacific
Reply:

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?


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VBS .CopyFolder Error help

VB cann open! Help please! www.computing.net/answers/programming/vb-cann-open-help-please/9645.html

vb runtime error www.computing.net/answers/programming/vb-runtime-error-/4091.html

echo vbs code but errors, help www.computing.net/answers/programming/echo-vbs-code-but-errors-help/18948.html