I am making a list of folders, where each folder needs only a few properties, so I'm using the Class below. However, no matter the folder, the FilesInFolder
property is alway 5 more than the actual number of files in the folder.
Can someone please help me find out what is wrong? Thanks.
Public Class Single_Action_Folder
Public ReadOnly FullName As String = ""
Public ReadOnly Name As String = ""
Public ReadOnly FilesInFolder As Integer = 0
Public ReadOnly Exists As Boolean = False
'**
' Constructor
'*
Public Sub New(Optional dir As DirectoryInfo = Nothing)
' First check that a directory has been specified
If dir Is Nothing Then Exit Sub
' Populate the class properties
FullName = dir.FullName
Name = dir.Name
FilesInFolder = dir.GetFiles().Count
Exists = dir.Exists
End Sub
End Class