ARTICLE

Directory and DirectoryInfo Classes in VB.NET

Posted by Sapna Articles | Visual Basic Language August 29, 2010
In this article I will explain you about Directory and DirectoryInfo Classes in VB.NET.
 
Reader Level:

HTML clipboard

The Directory and DirectoryInfo classes are used to perform various operations on directories such as Create, Move, Delete, and Enumerate. The functional distinction between these classes is the same as that between the File and FileInfo classes: the Directory class provides static methods whereas the DirectoryInfo class provides instance methods to deal with directories. Below, Table 6.2 compares these directory classes.

Table 6.2: Directory and DirectoryInfo class members

table-6.2.gif

Like the FileInfo class, the DirectoryInfo class also has a single constructor that takes either the full path or relative path to the directory as the input parameter:

Dim d1 As New DirectoryInfo("c:\temp") //Make a directory object

Some important properties of the DirectoryInfo class, such as CreationTime, Exists, FullName, LastAccessTime, LastWriteTime, Name, Parent, and Root, work as their names suggest. For example, CreationTime shows the creation time of the directory. FullName is the full qualified path of the directory, while Name is just the relative folder name without the path (e.g., a directory with the FullName of c:\My Project\test would have a Name of test).

Conclusion


Hope this article would have helped you in understanding Directory and DirectoryInfo Classes in VB.NET.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor