Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

read-only access

Posted on 2002-04-23
2
Medium Priority
?
154 Views
Last Modified: 2010-05-02
Hai,

I'm using the functions below to find some directory in which a user has write access. However, in a map with 50 subdirectories where the user only has write access to 5 of them I find the procedure to slow.

Does someone know a quicker way to check for write access to the sub maps?

(BTW, yes, most of the functions came out of VBA help files  ;-)   )

Function Make_List() As String
Dim MyPath As String, MyName As String, maplist As String
  MyPath = "f:\data\"
  MyName = Dir(MyPath, vbDirectory)
  Do While MyName <> ""
    If MyName <> "." And MyName <> ".." Then
      If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
            If check_access(MyPath & MyName & "\") Then maplist = maplist & "," & MyName
      End If
    End If
    MyName = Dir
  Loop
  Make_List = Right(maplist, Len(maplist) - 1)
End Function

Private Function check_access(pad As String) As Boolean
  On Error GoTo handler
  Open pad & "TESTFILE" For Output As #1
  Close #1
  Kill pad & "TESTFILE"
  check_access = True
  Exit Function
handler:
  check_access = False
End Function

Kind regards
0
Comment
Question by:ehout
[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
2 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 300 total points
ID: 6962315
ehout,

If you goto the following website you should get everything you need and more.

http://www.allapi.net/apilist/apifunction.php?apifunction=GetFileSecurity

This API should allow you to identify the security type on the folders you are checking.

There is also an example of how to get the Security Type and Change it.

Hope this helps.

0
 
LVL 3

Author Comment

by:ehout
ID: 7069801
Hi,

Indeed it seems to do the trick. However I'm not a hardcore programmer (though willing to learn). Could you or someone please tell me how to use that function?

The ntfs example seems a bit complex to me.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

618 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