Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


CopyFolder problem

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> CopyFolder problem
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 CopyFolder problem - 5/5/2008 2:26:59 PM   
  mwebb

 

Posts: 35
Score: 0
Joined: 1/30/2007
Status: offline
We have some department workstations in our Win 2003 domain that are used by multiple users and have important data stored on them. This data needs to be accessed by many different people. Because of the data's importance it makes sense to back it up on a server. Group policy redirection will not work because there are too many users to manage redirection and because the folders that need to be backed up are not the folders redirection will work with.

So I wrote a script, a sample below, that copies a folder from a workstation to a share on a server. The script works but erraticaly. Sometimes it runs fine other times (most of the time) I get a "access denied" because of permissions. I think the permissions are OK because I can reach the server share with the \\server\folder  in "run" and I can also map a network drive to the folder.

I have tried the script using both the \\server\share form for the destination folder and the mapped form "F:\" I get the same erratic results wth both methods.

What can I do to get this script to perform reliably?

--------------------------------------------------------------------------
'folder moving script
'This script copies folders from a local workstation to a server shared folder.
'If run more than once it will overwrite files that change

'On Error Resume Next

Dim objFilesys

SourceFolder = "c:\WordDocs"
DestFolder = "\\nvfs01\OB_WordDocs"

Set objFilesys = CreateObject("Scripting.FileSystemObject")

If objFilesys.FolderExists(SourceFolder) Then
objFilesys.CopyFolder SourceFolder, DestFolder, True
End If

WScript.Echo "Done!!"
WScript.Quit
 
 
Post #: 1
 
 RE: CopyFolder problem - 5/6/2008 12:28:39 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
If you get an access denied error then it is because the system is denying access to the script. That is what you need to track down. Changing the script will not address the issue.

_____________________________

"... 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 mwebb)
 
 
Post #: 2
 
 RE: CopyFolder problem - 5/6/2008 12:56:11 AM   
  mwebb

 

Posts: 35
Score: 0
Joined: 1/30/2007
Status: offline
I don't think I understand your point.

The script is running on the source machine. It starts successfully. The access denied error occurs when the script attempts to make a connection to the remote server that has the destination folder. This connection can be made when mapping a drive or using \\server\folder.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: CopyFolder problem - 5/6/2008 1:01:35 AM   
  dm_4ever


Posts: 2172
Score: 32
Joined: 6/29/2006
From: Orange County, California
Status: offline
Have you tried setting the destination to

\\nvfs01\OB_WordDocs\

_____________________________

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 mwebb)
 
 
Post #: 4
 
 RE: CopyFolder problem - 5/6/2008 1:04:58 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
Well, the code as written works 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 mwebb)
 
 
Post #: 5
 
 RE: CopyFolder problem - 5/6/2008 2:20:40 AM   
  mwebb

 

Posts: 35
Score: 0
Joined: 1/30/2007
Status: offline
Yes, I have tried this form and thru a mapped drive.

(in reply to dm_4ever)
 
 
Post #: 6
 
 RE: CopyFolder problem - 5/6/2008 2:24:18 AM   
  mwebb

 

Posts: 35
Score: 0
Joined: 1/30/2007
Status: offline
We have a very fast network 1Gb. Sometimes this causes issues especially during logon of XP machines.

Some questions:

Is there a way to extend the time for the connection before the error is produced?
Might it help to ping the dest computer before the connection is attempted?
Would it help if I tried another attempt by having an error try the connection again?

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: CopyFolder problem - 5/6/2008 4:42:50 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
Wait, is this running as a login/startup/logoff/shutdown script?

_____________________________

"... 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 mwebb)
 
 
Post #: 8
 
 RE: CopyFolder problem - 5/6/2008 6:32:59 AM   
  mwebb

 

Posts: 35
Score: 0
Joined: 1/30/2007
Status: offline
No, The script is run by the user opening the .vbs file.

(in reply to ebgreen)
 
 
Post #: 9
 
 
 
  

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 >> CopyFolder problem Page: [1]
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