O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required