# File & directory metadata - Documentation

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/guides/sandbox-filesystem-metadata

# File & directory metadata

You can use the `files.getInfo()` / `files.get_info()` method to retrieve metadata about a file or directory. It returns details such as the filename, type, and path.

##

[​](#getting-metadata-about-a-file)

Getting metadata about a file

JavaScript & TypeScript

Python

```
import { Sandbox } from 'novita-sandbox/code-interpreter'

const sandbox = await Sandbox.create()

// Create test file
const filePathInSandbox = '/tmp/test-file'
await sandbox.files.write(filePathInSandbox, 'test-file-content')

// Get file metadata
const info = await sandbox.files.getInfo(filePathInSandbox)
console.log(info)
// {
// name: 'test-file',
// type: 'file',
// path: '/tmp/test-file',
// size: 17,
// mode: 420,
// permissions: '-rw-r--r--',
// owner: 'user',
// group: 'user',
// modifiedTime: 2026-06-03T12:12:23.964Z,
// symlinkTarget: undefined
// }

await sandbox.kill()
```

```
from novita_sandbox.code_interpreter import Sandbox

sandbox = Sandbox.create()

# Create test file
file_path_in_sandbox = '/tmp/test-file'
sandbox.files.write(file_path_in_sandbox, 'test-file-content')

# Get file metadata
info = sandbox.files.get_info(file_path_in_sandbox)
print(info)
# EntryInfo(
# name='test-file',
# type=,
# path='/tmp/test-file',
# size=17,
# mode=420,
# permissions='-rw-r--r--',
# owner='user',
# group='user',
# modified_time=datetime.datetime(2026, 6, 3, 12, 14, 34, 745328),
# symlink_target=None
# )

sandbox.kill()
```

##

[​](#getting-metadata-about-a-directory)

Getting metadata about a directory

JavaScript & TypeScript

Python

```
import { Sandbox } from 'novita-sandbox/code-interpreter'

const sandbox = await Sandbox.create()

// Create test directory
const dirPathInSandbox = '/tmp/test-dir'
await sandbox.files.makeDir(dirPathInSandbox)

// Get directory metadata
const info = await sandbox.files.getInfo(dirPathInSandbox)
console.log(info)
// {
// name: 'test-dir',
// type: 'dir',
// path: '/tmp/test-dir',
// size: 40,
// mode: 493,
// permissions: 'drwxr-xr-x',
// owner: 'user',
// group: 'user',
// modifiedTime: 2026-06-03T12:13:59.194Z,
// symlinkTarget: undefined
// }

await sandbox.kill()
```

```
from novita_sandbox.code_interpreter import Sandbox

sandbox = Sandbox.create()

# Create test directory
dir_path_in_sandbox = '/tmp/test-dir'
sandbox.files.make_dir(dir_path_in_sandbox)

# Get directory metadata
info = sandbox.files.get_info(dir_path_in_sandbox)
print(info)
# EntryInfo(
# name='test-dir',
# type=,
# path='/tmp/test-dir',
# size=40,
# mode=493,
# permissions='drwxr-xr-x',
# owner='user',
# group='user',
# modified_time=datetime.datetime(2026, 6, 3, 12, 16, 4, 858056),
# symlink_target=None
# )

sandbox.kill()
```

Last modified on June 4, 2026
