Volume

Represents a kOSProcessor hard disk or the archive.

structure Volume

Suffix

Type

Description

FREESPACE

Scalar

Free space left on the volume

CAPACITY

Scalar

Total space on the volume

NAME

String

Get or set volume name

RENAMEABLE

Scalar

True if the name can be changed

ROOT

VolumeDirectory

Volume’s root directory

FILES

Lexicon

Lexicon of all files and directories on the volume

POWERREQUIREMENT

Scalar

Amount of power consumed when this volume is set as the current volume

EXISTS(path)

Boolean

Returns true if the given file or directory exists

CREATE(path)

VolumeFile

Creates a file

CREATEDIR(path)

VolumeDirectory

Creates a directory

OPEN(path)

VolumeItem or Boolean

Opens a file or directory

DELETE(path)

Boolean

Deletes a file or directory

Volume:FREESPACE
Type

Scalar

Access

Get only

Free space left on the volume

Volume:CAPACITY
Type

Scalar

Access

Get only

Total space on the volume

Volume:NAME
Type

String

Access

Get and Set

Gets or sets volume name. This name can be used instead of the volumeId with some file and volume-related commands

Volume:RENAMEABLE
Type

Boolean

Access

Get only

True if the name of this volume can be changed. Currently only the name of the archive can’t be changed.

Volume:FILES
Type

Lexicon of VolumeItem

Access

Get only

List of files and directories on this volume. Keys are the names of all items on this volume and values are the associated VolumeItem structures.

Volume:ROOT
Type

VolumeDirectory

Access

Get only

Returns volume’s root directory

Volume:POWERREQUIREMENT
Type

Scalar

Access

Get only

Amount of power consumed when this volume is set as the current volume

Volume:EXISTS(path)
Returns

Boolean

Returns true if the given file or directory exists. This will also return true when the given file does not exist, but there is a file with the same name and .ks or .ksm extension added. Use Volume:FILES:HASKEY(name) to perform a strict check.

Paths passed as the argument to this command should not contain a volume id or name and should not be relative.

Volume:OPEN(path)
Returns

VolumeItem or Boolean false

Opens the file or directory pointed to by the given path and returns VolumeItem. It will return a boolean false if the given file or directory does not exist.

Paths passed as the argument to this command should not contain a volume id or name and should not be relative.

Volume:CREATE(path)
Returns

VolumeFile

Creates a file under the given path and returns VolumeFile. It will fail if the file already exists.

Paths passed as the argument to this command should not contain a volume id or name and should not be relative.

Volume:CREATEDIR(path)
Returns

VolumeDirectory

Creates a directory under the given path and returns VolumeDirectory. It will fail if the directory already exists.

Paths passed as the argument to this command should not contain a volume id or name and should not be relative.

Volume:DELETE(path)
Returns

boolean

Deletes the given file or directory (recursively). It will return true if the given item was successfully deleted and false otherwise.

Paths passed as the argument to this command should not contain a volume id or name and should not be relative.