Directory Class |
System.IO
No
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.
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 .
File Class