Solved

VBScript Check if folder exists

Posted on 2010-11-17
8
1,838 Views
Last Modified: 2012-05-11
I have a list of UNC Paths that I want to go through to see if each one exists or not so I can filter out the ones that dont exists.

The problem I am having is when I come to a UNC Path that exists (but I do not have access to) the VBScript gives me an Error 76 (Path not found) so objFSO.FolderExists will return a FALSE.

Is there another way to find out if a folder exists or not but can also differenciate between paths that dont exists and paths that exist but I do not have access to?

Thanks
0
Comment
Question by:tr57285
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 34155656
>>Is there another way to find out if a folder exists or not but can also differenciate between paths
>>that dont exists and paths that exist but I do not have access to?


Not by using the FileSystemObject, I'm afraid :(
0
 

Author Comment

by:tr57285
ID: 34155771
ok, can you give me another way?
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 34155804
I cannot, but it stands to reason that the only way you are going to be able to do this is to have the VBScript execute using a login that DOES have proper access rights to the folder.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:rogerard
ID: 34155805
Then create a function to check for it:
Private Function issubform(ByVal frm As Form) As Boolean
    On Error GoTo ErrorCheck
    issubform = True
    If Me.Parent <> "" Then
        issubform = True
    End If
    Exit Function

ErrorCheck:
    If Err.Number = 2452 Then
        issubform = False
    End If
          
End Function

Open in new window

0
 
LVL 7

Expert Comment

by:rogerard
ID: 34155834
Sorry....  posted to wrong page  :(
0
 
LVL 10

Expert Comment

by:GlobaLevel
ID: 34155841
I have found that if you are looping thru UNC paths in vbscript...it hangs after it finds the first one...then throws the error you provide...and if you have to kill the script..eachtime to sarch the next UNC path...why have the program to begin with...

you would be better off with WMI...this can get you started...
http://msdn.microsoft.com/en-us/library/aa389290(VS.85).aspx
0
 
LVL 7

Accepted Solution

by:
rogerard earned 500 total points
ID: 34155903
0
 

Author Closing Comment

by:tr57285
ID: 36222515
Exactly what I was looking for.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question