VB - Read single attribute from file

By , 4/9/2008
(1 ratings)
With this function you are able to read a single attribute from a file like Read-Only. So you can easily check if a special file attribute is given.
Public Function IsAttributeGiven(ByVal FileName As String, ByVal CheckAttribute As FileAttribute) As Boolean
    Dim Attr As FileAttributes
    Attr = File.GetAttributes(FileName)
    If (Attr And CheckAttribute) = CheckAttribute Then Return True
End Function

Tagged with attribute, file.



Log in, to comment!