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");


Методы

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.

Атрибуты

Type (только для чтения) Returns always "directory"
PathSeparator (только для чтения) Returns the standard path separator character.
CurrentDirectory Gets or sets the current working directory for an application.
TempDirectory (только для чтения) Returns Windows temporary directory.

Create(Path)

Creates a new directory or directory tree.

Параметры

Path
Specifies the path to be created.

Возвращаемое значение

Returns true if the directory tree has been successfuly created.


Delete(Path)

Deletes a directory.

Параметры

Path
The directory to be deleted.

Возвращаемое значение

Returns true if the directory has been successfuly deleted.

Примечания

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.

Параметры

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

Возвращаемое значение

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.

Параметры

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

Возвращаемое значение

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


GetDrives()

Returns list of present disk drives.

Возвращаемое значение

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