Not including hidden files in list of files in directory
For the code: Dim filelist_fileListingFrom As Object = My.Computer.FileSystem.GetFiles(filelist_RootFromFolder, FileIO.SearchOption.SearchTopLevelOnly)
How can I prevent it from finding hidden files as well
The GetFiles method by default finds all files ..once you have those files you can check for the hidden attribute and parse those files out:
Imports System.collections.objectmodel
Imports System.io
Public
Sub Test2()
Dim filelist_RootFromFolder As String = "C:\"
Dim filelist_fileListingFrom As ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(filelist_RootFromFolder, FileIO.SearchOption.SearchTopLevelOnly)
Dim MyList As New List(Of String)
For Each s As String In filelist_fileListingFrom
Dim TheFile As New FileInfo(s)
If Not (TheFile.Attributes = FileAttributes.Hidden) Then
MyList.Add(s)
End If
Next
End Sub
Not including hidden files in list of files in directory
Not including hidden files in list of files in directory
Cmeyla
The GetFiles method by default finds all files ..once you have those files you can check for the hidden attribute and parse those files out:
Imports System.collections.objectmodel
Imports System.io
Public
Sub Test2() Dim filelist_RootFromFolder As String = "C:\" Dim filelist_fileListingFrom As ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(filelist_RootFromFolder, FileIO.SearchOption.SearchTopLevelOnly) Dim MyList As New List(Of String) For Each s As String In filelist_fileListingFrom Dim TheFile As New FileInfo(s) If Not (TheFile.Attributes = FileAttributes.Hidden) Then MyList.Add(s) End If Next End Sub