#File or directory information
<subtitle>Get detailed information about a file or directory. </subtitle>

You can use the `files.get_info()` method to get information about a file or directory. The information returned includes file name, type, path, etc.

Files can also carry custom user-defined metadata, which is returned in the `metadata` field - see [Custom Metadata](/docs/agent-sandbox/filesystem/metadata.md).

## Get file information

```python
from ucloud_sandbox import Sandbox

sandbox = Sandbox.create()

#Create new file
sandbox.files.write('test_file', 'Hello, world!')

# Get file information
info = sandbox.files.get_info('test_file')

print(info)
# EntryInfo(
#   name='test_file.txt',
#   type=<FileType.FILE: 'file'>,
#   path='/home/user/test_file.txt',
#   size=13,
#   mode=0o644,
#   permissions='-rw-r--r--',
#   owner='user',
#   group='user',
#   modified_time='2025-05-26T12:00:00.000Z',
#   symlink_target=None
# )
```

## Get directory information

```python
from ucloud_sandbox import Sandbox

sandbox = Sandbox.create()

#Create new directory
sandbox.files.make_dir('test_dir')

# Get directory information
info = sandbox.files.get_info('test_dir')

print(info)
# EntryInfo(
#   name='test_dir',
#   type=<FileType.DIR: 'dir'>,
#   path='/home/user/test_dir',
#   size=0,
#   mode=0o755,
#   permissions='drwxr-xr-x',
#   owner='user',
#   group='user',
#   modified_time='2025-05-26T12:00:00.000Z',
#   symlink_target=None
# )
```
