VB.Net Tutorial/Stream File/FileSystemInfo

Материал из VB Эксперт
Перейти к: навигация, поиск

Get FileSystemInfos

Imports System.IO
public class Test
   public Shared Sub Main
        Dim strPath As String = "C:\Program Files"
        Dim objDI As New DirectoryInfo(strPath)
        Dim aryItemsInfo() As FileSystemInfo
        Dim objItem As FileSystemInfo
        aryItemsInfo = objDI.GetFileSystemInfos()
        For Each objItem In aryItemsInfo
            If objItem.Attributes And FileAttributes.Directory Then
                Console.WriteLine("FOLDER ")
            Else
                Console.WriteLine("FILE ")
            End If
            Console.WriteLine(objItem.Name)
        Next
   End Sub
End class
FOLDER
Adobe
FOLDER
AMD
FOLDER
ATI Technologies
FOLDER