Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Problem copying folder to Folder

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,49552
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem copying folder to Folder
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Problem copying folder to Folder - 7/16/2007 3:12:55 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
Does anyone see anything wrong with this code? I keep getting : Error Num: 5 Invalid procedure call or argument

It happens at "  objFSO.CopyFolder SOURCE_FILES, strDestination, True"
I'm copying from one remote system to another.


      
 
 
Post #: 1
 
 RE: Problem copying folder to Folder - 7/16/2007 3:15:11 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Where is SOURCE_FILES defined?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 2
 
 RE: Problem copying folder to Folder - 7/16/2007 3:57:31 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
It's a constant defined outside this Sub. I only posted the sub but if you think it will help I'll post the whole script.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Problem copying folder to Folder - 7/16/2007 4:06:18 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Yes, I believe that it will help.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 4
 
 RE: Problem copying folder to Folder - 7/16/2007 5:54:33 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
Server.txt is just a list of servers on our network that we would like the data copied too.


      

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Problem copying folder to Folder - 7/16/2007 7:42:16 AM   
  dm_4ever


Posts: 2724
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
try changing the following

  strDestination = "\\" & strComputer & "\c$\FSBA\"
 
  If not(objFSO.FolderExists(strDestination)) Then
      objFSO.CreateFolder(strDestination)
  End If

  Set objDestination = objFSO.GetFolder(strDestination) 'remove

  objFSO.CopyFolder SOURCE_FILES, strDestination, True

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 6
 
 RE: Problem copying folder to Folder - 7/17/2007 12:38:17 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
I tried doing it that way first. Then I added the objDestination to see if that made a difference.

I just tried it again this way and I get the same error.

(in reply to dm_4ever)
 
 
Post #: 7
 
 RE: Problem copying folder to Folder - 7/17/2007 4:02:40 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
Does it look like a coding issue to anyone? I'm not the best coder out there. I just don't understand why it's giving me this error. I've had it send the strDestination to the screen to make sure the paths were correct and they appear to be. i can manually create files in the folder with this account so i don't think it's permissions. Any other suggestions? Thank you for the help.

(in reply to Mindmesh)
 
 
Post #: 8
 
 RE: Problem copying folder to Folder - 7/17/2007 4:06:28 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Is the error that you are getting still the invalid procedure call?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 9
 
 RE: Problem copying folder to Folder - 7/17/2007 5:31:41 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
Here's the error:

Failed to Copy: \\w2k3FileServer\FSBA
Error Num: 5 Invalid procedure call or argument

(in reply to ebgreen)
 
 
Post #: 10
 
 RE: Problem copying folder to Folder - 7/17/2007 5:41:30 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
And could you please post the exact code that is giving you that error? I sometimes have a hard time keeping track of the changes that people make as we work through a problem like this.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 11
 
 RE: Problem copying folder to Folder - 7/17/2007 6:13:29 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
This code and the code above (Which are slightly different) are giving me the same error.



      

(in reply to ebgreen)
 
 
Post #: 12
 
 RE: Problem copying folder to Folder - 7/17/2007 6:21:10 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
What happens if you take out the On Error Resume Next?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 13
 
 RE: Problem copying folder to Folder - 7/17/2007 6:24:03 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
C:\Scripts\Work\FSBACopy.vbs(56, 2) Microsoft VBScript runtime error: Invalid procedure call or argument



which points to this part of the code:

objFSO.CopyFolder SOURCE_FILES, strDestination, True

(in reply to ebgreen)
 
 
Post #: 14
 
 RE: Problem copying folder to Folder - 7/17/2007 6:37:31 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
put this line right before the line that errors then post back with the result:

WScript.Echo SOURCE_FILES & " TO " & strDestination

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 15
 
 RE: Problem copying folder to Folder - 7/17/2007 6:42:00 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
\\w2k3FileServer\FSBA TO \\w2k3DC1\c$\FSBA
C:\Scripts\Work\FSBACopy.vbs(58, 2) Microsoft VBScript runtime error: Invalid procedure call or argument

(in reply to ebgreen)
 
 
Post #: 16
 
 RE: Problem copying folder to Folder - 7/17/2007 6:55:47 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
have you tried putting trailing \s on the paths? I'm running out of ideas because it all looks fine.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 17
 
 RE: Problem copying folder to Folder - 7/17/2007 7:15:10 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
Just tried. Same error. I thought it looked ok, but I have a tendancy to miss the obvious sometimes.

(in reply to ebgreen)
 
 
Post #: 18
 
 RE: Problem copying folder to Folder - 7/17/2007 7:20:43 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Yeah...someone will wander along and point out something that makes me slap my forehead at some point I hope.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Mindmesh)
 
 
Post #: 19
 
 RE: Problem copying folder to Folder - 7/17/2007 7:32:03 AM   
  Mindmesh

 

Posts: 78
Score: 0
Joined: 11/23/2004
From:
Status: offline
yeah, me too. But thank you for trying to figure it out. 

(in reply to ebgreen)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Problem copying folder to Folder Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts