Directory Class

   
Directory Class

Namespace

System.IO

Createable

No

Description

The Directory class represents a directory or folder. (It appears that Microsoft is retreating from the term folder , in favor of the legacy term directory .) The Directory class has a number of methods that allow you to retrieve information about the directory's system properties, to move and delete a directory, and to create a new directory. (Unfortunately, however, the Directory class lacks a Copy method.)

All of the members of the Directory class are shared methods, so they can be called without instantiating any objects. For example, you can call the CreateDirectory method as follows :

 Directory.CreateDirectory("C:\projects\project1") 

This syntax may seem a bit awkward , especially to those familiar with earlier version of VB. Rather than the Directory object itself representing a directory, as it does in the case of a Folder object in the VB 6 FileSystemObject object model, the Directory class is simply a means to access a set of directory- related functions.

Directory class members marked with a plus sign (+) are discussed in further detail in their own entries.

Public Shared Methods

CreateDirectory +
Delete +
Exists +
GetCreationTime +
GetCurrentDirectory
GetDirectories +
GetDirectoryRoot +
GetFiles +
GetFileSystemEntries +
GetLastAccessTime
GetLastWriteTime
GetLogicalDrives +
GetParent +
Move +
SetCreationTime
SetCurrentDirectory
SetLastAccessTime
SetLastWriteTime

VB.NET/VB 6 Differences

The Directory object loosely corresponds to the Folder object in the FileSystemObject object model. (The FileSystemObject object and its child objects are implemented in the Microsoft Scripting Runtime Library in the file scrrun.dll .) There is, however, a significant difference in the members of each class, and in some cases, methods with similar functionality have different names .

See Also

File Class

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net