Getting a directory listing
I know that I can use GetFiles to get a listing of the files in a directory. However, this command seems to just return a collection of strings with the file names. What command can I use that will provide both the files' names and the types of the files, i.e., file, directory, link, etc?
Re: Getting a directory listing
Re: Getting a directory listing
Good call. Here’s a simplified version of my code:
Code:
Sub Main()
Dim DI As New DirectoryInfo(basePath)
Dim allItems() As FileSystemInfo = DI.GetFileSystemInfos()
Dim Item As FileSystemInfo
For Each Item In allItems
<value> = fileAttr(Item.Attributes)
Next
End Sub
Function fileAttr(ByVal attrVal As Integer) As XXX
If (attrVal And FILE_ATTRIBUTE_READONLY) = FILE_ATTRIBUTE_READONLY Then <val> = ??
<etc>
Return <val>
End Function
Only one more question: I found no file attributes to indicate if a file is a shortcut (in Linux-eze, symbolic link). Anyway to figure this out?
Re: Getting a directory listing