Skip to content

Directory

Directory reads the files in a folder in one go and passes the text of each one to the flow, along with its location. It reads text documents, PDFs, Word documents, spreadsheets, data files (CSV, JSON, YAML, XML), web pages and code files.

Use it when you have several documents grouped in a folder and want an agent or a model to work with all of them.

When to use it

  • Load every manual in a folder into a knowledge base.
  • Have an agent summarise a set of reports.
  • Review in one go the contracts stored in a folder and its subfolders.

Configuration

FieldWhat it does
PathThe folder you want to read.
TypesOptional. The file extensions you want to load, separated by commas, for example pdf, docx. Only files with those extensions are read. Leave it empty to read every supported file type listed above.
DepthHow many levels of subfolders are read. With 0, the Recursive setting is used. Default: 0.

Advanced options

FieldWhat it does
RecursiveAlso reads the files in every subfolder. When off, it reads only the files in the chosen folder.
Load HiddenAlso reads hidden files.
Silent ErrorsIf a file can’t be read, skips it and carries on with the rest instead of stopping the flow.
Use MultithreadingReads several files at the same time to finish sooner.
Max ConcurrencyWith Use Multithreading, how many files are read at the same time. Default: 2.

Output

The Data output returns one item per file read, with its text and its location. Connect it to an agent, a model or a document store.

Example

A quality department wants to query its procedures with an agent:

  1. Add Directory and, in Path, pick the procedures folder.
  2. In the advanced options, turn on Recursive to include the subfolders and Silent Errors so a damaged file doesn’t stop the reading.
  3. Connect Data to a document store.
  4. Connect an agent to that store to answer questions about the procedures.

Good practices

  • Turn on Silent Errors when the folder holds many files: a single damaged file won’t stop the flow.
  • With large folders, turn on Use Multithreading to speed up the reading.
  • File: reads a single file.
  • Parse Data: turns the data read into text.