Skip to main content
A directory on a [Machine]‘s filesystem. Obtain via [Machine.dir] or [Machine.tempDir]. The handle stays bound to the machine it came from: paths are meaningful only on that machine, and all operations run there.

Constructor

Returns

Directory

Methods

copyTo()

Copies the directory recursively to dest on the same machine, returning a handle to the copy. Fails when dest already exists. Local: an absolute dest is used as-is. A relative dest is joined to the SimularFiles root (.. is kept — this is a default base, not a sandbox). Android: dest must be absolute.

Parameters

string
required

Returns

Directory

delete()

Deletes the directory and everything in it, invalidating the handle.

isReadonly()

Whether the directory is read-only.

Returns

boolean

listDirs()

All subdirectories of this directory (non-recursive), hidden ones included.

Returns

Directory[]

listFiles()

All files in this directory (non-recursive), hidden files included.

Returns

File[]

modified()

The last modification time of the directory itself as milliseconds since the Unix epoch.

Returns

number

moveTo()

Moves the directory to dest on the same machine. Fails when dest already exists. Path resolution as in [Directory.copyTo].

Parameters

string
required

name()

The directory name (last component of the path).

Returns

string

path()

The directory’s path on its machine, as a string.

Returns

string

rename()

Renames the directory in place (same parent directory). newName must be a single filename component.

Parameters

string
required