The System.IO.FileInfo Class

Similarly to what you learned about the System.IO.DirectoryInfo class, there is also a System.IO.FileInfo counterpart for the System.IO.File class. An instance of the FileInfo class is therefore a representation of a single file, providing members that enable you to perform operations on that particular file or get/set information. Because FileInfo inherits from System.IO.FileSystemInfo like DirectoryInfo, you can find the same members. You create an instance of the FileInfo class by passing the filename to the constructor, as demonstrated here:

Dim fi As New FileInfo("C:\MyFile.txt")

You can set attributes for the specified file assigning the Attributes property, which receives a value ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.