Directory - Kirix Documentation

Developer Resources

Directory

Overview

The Directory class provides information about directories, including information about what files and subdirectories are contained in a directory.

Methods

Directory.createDirectory
Creates a directory
Directory.delete
Deletes a directory
Directory.exists
Determines if a directory exists
Directory.getAll
Returns all files and subdirectories found in a specified directory.
Directory.getDirectories
Returns all the subdirectories found in a specified directory.
Directory.getFiles
Returns all files found in a specified directory.

Example

// test if a directory exists, if it does, list
// the subdirectories in the directory

var dir = "c:\\";
if (!Directory.exists(dir))
{
    alert("'" + dir + "'" + " doesn't exist.");
}
else
{
    var dirlist;
    dirlist = Directory.getDirectories(dir);

    var output;
    output += "In ";
    output += "'" + dir + "'";
    output += ", there are ";
    output += dirlist.length;
    output += " subdirectories:\n\n";

    for (var d in dirlist)
    {
        output += dirlist[d];
        output += "\n";
    }

    alert(output);
}

Directory.createDirectory

static function Directory.createDirectory(path : String) : Boolean

Arguments

path
The directory to create

Returns

True if the directory was successfully created, false otherwise

Description

Calling this method creates the directory specified in the path parameter

Directory.delete

static function Directory.delete(path : String) : Boolean

Arguments

path
The directory to delete

Returns

True if the directory was successfully deleted, false otherwise

Description

Calling this method deletes the directory specified in the path parameter

Directory.exists

static function Directory.exists(path : String) : Boolean

Arguments

path
The path to check

Returns

True if the specified path exists and is a directory, false otherwise

Description

Calling this method determines whether the path specified in the path parameter exists and is a directory.

Directory.getAll

static function Directory.getAll(path : String) : Array(String)

Arguments

path
The path to read.

Returns

An array containing string values which represent the files and directories contained in the directory specified in the path parameter

Description

Calling this method returns all files and subdirectories found in the directory specified by path.

Directory.getDirectories

static function Directory.getDirectories(path : String) : Array(String)

Arguments

path
The path to read.

Returns

An array containing string values which represent the subdirectories contained in the directory specified in the path parameter

Description

Calling this method returns all subdirectories found in the directory specified by path.

Directory.getFiles

static function Directory.getFiles(path : String) : Array(String)

Arguments

path
The path to read.

Returns

An array containing string values which represent the files contained in the directory specified in the path parameter

Description

Calling this method returns all files found in the directory specified by path. Directories and other special files are not included in the resulting array.