Results 1 to 3 of 3

Thread: File Attributes

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    34

    Post

    Hi,

    Is there anyway to use the "SetAttr" statement to change the attributes using "*.*"?

    Please advice.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You could write your own Wrapper Sub which has the Extended Capability of handling WildCards, ie.
    Code:
    Public Sub SetAttrEx(ByVal PathName As String, ByVal Attributes As VbFileAttribute)
        Dim sDir As String
        Dim sPath As String
        Dim iPos As Integer
        
        While InStr(iPos + 1, PathName, "\")
            iPos = InStr(iPos + 1, PathName, "\")
        Wend
        If iPos Then
            sPath = Left$(PathName, iPos)
        Else
            sPath = PathName
        End If
        
        sDir = Dir(PathName)
        While Len(sDir)
            If (GetAttr(sPath & sDir) And vbDirectory) <> vbDirectory Then
                Call SetAttr(sPath & sDir, Attributes)
            End If
            sDir = Dir
        Wend
    End Sub
    Usage:
    Same as SetAttr() but can also handle Wild Cards, ie.
    Call SetAttr("C:\Files\*.txt", vbReadOnly)


    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    34

    Post

    Thank you very much for your reply.

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width