5.1. Retrieve Information About a File, Directory, or Drive


You need to retrieve information about a file, directory, or drive.


Create a new System.IO.FileInfo, System.IO.DirectoryInfo, or System.IO.DriveInfo object, depending on the type of resource about which you need to retrieve information. Supply the path of the resource to the constructor, and then you will be able to retrieve information through the properties of the class.

How It Works

To create a FileInfo, DirectoryInfo, or DriveInfo object, you supply a relative or fully qualified path to the constructor. You can also use the GetFileInfo, GetDirectoryInfo, and GetDriveInfo Shared methods of the My.Computer.FileSystem. These methods return an instance of a FileInfo, ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.