本文整理匯總了VB.NET中System.IO.FileSystemInfo類的典型用法代碼示例。如果您正苦於以下問題:VB.NET FileSystemInfo類的具體用法?VB.NET FileSystemInfo怎麽用?VB.NET FileSystemInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FileSystemInfo類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Module1
' 導入命名空間
Imports System.IO
Module Module1
Sub Main()
' Loop through all the immediate subdirectories of C.
For Each entry As String In Directory.GetDirectories("C:\")
DisplayFileSystemInfoAttributes(New DirectoryInfo(entry))
Next
' Loop through all the files in C.
For Each entry As String In Directory.GetFiles("C:\")
DisplayFileSystemInfoAttributes(New FileInfo(entry))
Next
End Sub
Sub DisplayFileSystemInfoAttributes(ByVal fsi As IO.FileSystemInfo)
' Assume that this entry is a file.
Dim entryType As String = "File"
' Determine if this entry is really a directory.
If (fsi.Attributes And FileAttributes.Directory) = FileAttributes.Directory Then
entryType = "Directory"
End If
' Show this entry's type, name, and creation date.
Console.WriteLine("{0} entry {1} was created on {2:D}", _
entryType, fsi.FullName, fsi.CreationTime)
End Sub
End Module
' Output will vary based on contents of drive C.
'
' Directory entry C:\Documents and Settings was created on Tuesday, November 25, 2003
' Directory entry C:\Inetpub was created on Monday, January 12, 2004
' Directory entry C:\Program Files was created on Tuesday, November 25, 2003
' Directory entry C:\RECYCLER was created on Tuesday, November 25, 2003
' Directory entry C:\System Volume Information was created on Tuesday, November 2, 2003
' Directory entry C:\WINDOWS was created on Tuesday, November 25, 2003
' File entry C:\IO.SYS was created on Tuesday, November 25, 2003
' File entry C:\MSDOS.SYS was created on Tuesday, November 25, 2003
' File entry C:\pagefile.sys was created on Saturday, December 27, 2003