Advertisement

07.09.2008 at 03:26PM PDT, ID: 23552129
[x]
Attachment Details

vbs set objFSO does not exist and quits with error

Asked by TSBarnette in VB Script

I am trying to copy a file from a DFS share location on a server to the local machine.  Before i do the copy I  check to see if the file exist on the server and if not echo and error and then quit.  If file does exist on server then copy the file.  The entire script runs without error if the file exist on the server.  I am trying to test for all possible scenerios and I remove the file from the server to validate the echo but the script bombs at the Set objServerFile and generates an vbscript error window that tells me the file can't be found.  Any idea's?
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
Sub Copy_Files	
 
'Copies the correct Exceed.xcfg file based on information gathered
 
Dim objLocalFile
Dim objServerFile
 
Set objLocalFile = objFSO.GetFile(strConfigPath)
 
	Select Case intDisplayHeads
	
			Case 2	
 
				Set objServerFile = objFSO.GetFile("\\" & strDomain & "\shares\windows\xxxx.xxx")
				
				If objFSO.FileExists(objServerFile) Then
 
				objFSO.CopyFile objServerFile.Path, objLocalFile.Path, OverwriteExisting
				
				Else
				
					WScript.Echo "Correct xxxxx.xxx does not exist on server.  Contact System Administrator. Exiting...."
					
				End if
[+][-]07.09.2008 at 04:07PM PDT, ID: 21969167

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.09.2008 at 04:53PM PDT, ID: 21969419

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: VB Script
Sign Up Now!
Solution Provided By: RobSampson
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.10.2008 at 09:15AM PDT, ID: 21974928

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.10.2008 at 04:02PM PDT, ID: 21978120

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628