Directory object

The Directory object allows you to access directories on disk. This object is always available in a form of predefined Directory global variable.

// create directory structure
Directory.Create("c:\somedir\otherdir");


Methods

Create Creates a new directory or directory tree.
Delete Deletes a directory.
GetFiles Returns list of files stored in a given directory.
GetDirectories Returns list of sub-directories stored in a given directory.
GetDrives Returns list of present disk drives.

Attributes

Type (read only) Returns always "directory"
PathSeparator (read only) Returns the standard path separator character.
CurrentDirectory Gets or sets the current working directory for an application.
TempDirectory (read only) Returns Windows temporary directory.

Create(Path)

Creates a new directory or directory tree.

Parameters

Path
Specifies the path to be created.

Return value

Returns true if the directory tree has been successfuly created.


Delete(Path)

Deletes a directory.

Parameters

Path
The directory to be deleted.

Return value

Returns true if the directory has been successfuly deleted.

Remarks

This method only deletes one directory, not the entire directory tree specified in the Path parameter.


GetFiles(Path, Mask)

Returns list of files stored in a given directory.

Parameters

Path
The directory to be searched
Mask
Mask for the filenames to be matched against (optional, default=*.*)

Return value

Returns an Array object containing filenames of all the files stored in a given directory.


GetDirectories(Path, Mask)

Returns list of sub-directories stored in a given directory.

Parameters

Path
The directory to be searched
Mask
Mask for the sub-directories to be matched against (optional, default=*.*)

Return value

Returns an Array object containing names of all the sub-directories stored in a given directory.


GetDrives()

Returns list of present disk drives.

Return value

Returns an Array object containing names of all the disk drives, such as "c:\".