I'm trying to understand the returned values using System.IO.File.GetAttributes(filename)
If I take a random file that shows in explorer the Boxes Checked are Read only & File Ready For Archiving
The Result If you enumerate are
File Attributes for C:\Users\Public\Wireshark IP Map a01688\ipmap.html Are :
8
2
2
5
Unchecking those 2 boxes so None are checked I get back,
File Attributes for C:\Users\Public\Wireshark IP Map a01688\ipmap.html Are :
8
1
9
2
A copy of the file with only encrypted checked returns,
File Attributes for C:\Users\Public\Wireshark IP Map a01688\ipmap - Encrypted.html Are :
2
4
5
7
6
Same Copy With encrypted,File ready for archiving ,index this file for faster searching. returns.
File Attributes for C:\Users\Public\Wireshark IP Map a01688\ipmap - Encrypted.html Are :
1
6
4
1
6
I can not find anything that defiantly says this is what this number means.
I tried using a case statement and using the Values here
http://msdn.microsoft.com/en-us/library/system.io.fileattributes(v=vs.90).aspx[
^]
I assumed that it would start at 1 and go from there, but during a test of several files it returned a value of "0".
Either way if I start index at 0 or 1 results don't make sense.
The reuslts also do not appear to match up to what is defined on this page.
http://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx[
^]
Would someone please point me in the right direction.
Thank you for any help.
Code used to produce the results:
Imports System
Imports System.IO
Imports System.Security.AccessControl
Imports System.Text
Private Sub btnGetFileAttributes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetFileAttributes.Click
Dim filename As String = Nothing
Try
Dim strBuilder As New StringBuilder
Dim Attributes As String = System.IO.File.GetAttributes(filename)
For Each atb In Attributes
strBuilder.AppendLine(atb)
Next
Dim OutputString As String
OutputString = ("File Attributes for " & filename & " Are :" & vbNewLine & strBuilder.ToString)
TextBox1.Text = OutputString
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub