Returns a DirectoryInfo object for the specified path.
' Usage Dim value As System.IO.DirectoryInfo = My.Computer.FileSystem.GetDirectoryInfo(directory) ' Declaration Public Function GetDirectoryInfo( _ ByVal directory As String _ ) As System.IO.DirectoryInfo
String. Path of directory. Required.
The following conditions may cause an exception:
The directory path is not valid for one of the following reasons: it is a zero-length string; it contains only white space; it contains invalid characters; or it is a device path (starts with \\.\) (ArgumentException).
The directory path is not valid because it is Nothing (ArgumentNullException).
The directory path exceeds the system-defined maximum length (PathTooLongException).
A file or directory name in the directory path contains a colon (:) or is in an invalid format (NotSupportedException).
The user lacks necessary permissions to view the directory path (SecurityException).
The following table lists examples of tasks involving the My.Computer.FileSystem.GetDirectoryInfo method.
Determine when a directory was created
Determine whether a directory is read-only
This example gets a DirectoryInfo object for the directory C:\Documents and Settings and displays the directory's creation time, last access time, and last write time.
Dim getInfo As System.IO.DirectoryInfo getInfo = My.Computer.FileSystem.GetDirectoryInfo _ (My.Computer.FileSystem.SpecialDirectories.MyDocuments) MsgBox("The directory was created at " & getInfo.CreationTime) MsgBox("The directory was last accessed at " & getInfo.LastAccessTime) MsgBox("The directory was last written to at " & getInfo.LastWriteTime)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)