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
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor