> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Directory

> A directory on a []'s filesystem.

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

```typescript
Directory(): Directory
```

### Returns

`Directory`

## Methods

### copyTo()

```typescript
copyTo(dest: string): Directory
```

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

<ResponseField name={"dest"} type={"string"} required />

#### Returns

`Directory`

### delete()

```typescript
delete(): void
```

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

### isReadonly()

```typescript
isReadonly(): boolean
```

Whether the directory is read-only.

#### Returns

`boolean`

### listDirs()

```typescript
listDirs(): Directory[]
```

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

#### Returns

`Directory[]`

### listFiles()

```typescript
listFiles(): File[]
```

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

#### Returns

`File[]`

### modified()

```typescript
modified(): number
```

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

#### Returns

`number`

### moveTo()

```typescript
moveTo(dest: string): void
```

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

#### Parameters

<ResponseField name={"dest"} type={"string"} required />

### name()

```typescript
name(): string
```

The directory name (last component of the path).

#### Returns

`string`

### path()

```typescript
path(): string
```

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

#### Returns

`string`

### rename()

```typescript
rename(newName: string): void
```

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

#### Parameters

<ResponseField name={"newName"} type={"string"} required />
