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

# From Directory • AI Agent SDK

> from_directory: Create CorpusStats from directory scan.

# from\_directory

Method

> This is a method of the [**CorpusStats**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/CorpusStats.md) class in the [**indexing**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/indexing.md) module.

Create CorpusStats from directory scan.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def from_directory(path: str, extensions: Optional[List[str]]) -> 'CorpusStats'
```

## Parameters

**path** `str` *required*

Directory path to scan

**extensions** `Optional`

Optional list of extensions to include

### Returns

**Returns** `'CorpusStats'`

CorpusStats with file count and token estimate

## Uses

* `os.walk`
* `splitext`
* `getsize`
* `cls`
* `isoformat`
* `datetime.now`

## Used By

* [`Knowledge.index`](../functions/Knowledge-index)

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/knowledge/indexing.py#L66)
>
> `praisonaiagents/knowledge/indexing.py` at line 66


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.