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
Solved

VBScript Check if folder exists

Posted on 2010-11-17
8
1,820 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 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