> For the complete documentation index, see [llms.txt](https://docs.aios.foundation/aios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aios.foundation/aios-docs/aios-kernel/storage/sto_create_directory.md).

# sto\_create\_directory

```python
def sto_create_directory(self, dir_name: str, dir_path: str, collection_name: str = None) -> str
```

[Source code](https://github.com/agiresearch/AIOS/blob/main/aios/storage/filesystem/lsfs.py)

Description: Create a directory based on either dir\_name or dir\_path

* If the dir\_path is provided, it will create the file directly at the location of the dir\_path
* Else If the dir\_name is provided, the directory will be created at the path of os.path.join(self.root\_dir, dir\_name)

Parameters:

* dir\_name (str): Name of the file to create
* dir\_path (str): Full path where to create the file
* collection\_name (str): Name of the collection/agent (optional)

Returns:

* Success message (str): "Directory has been created successfully at: {dir\_path}"
* Exists message (str): "Directory already exists at: {dir\_path}"
* Error message (str): "Error creating directory: {error\_message}"
