Skip to content

Directory

⚠️ DEPRECATION WARNING

This component is deprecated and will be removed in a future version of Nappai. Please migrate to the recommended alternative components.

The Directory component lets you load files from a folder on your system. You can choose which file types to include, how deep to search, and whether to include hidden files. The component returns the contents of each file as a Data object that can be used by other components in your workflow.

How it Works

When you provide a folder path, the component scans that folder and any sub‑folders (if you enable recursion). It builds a list of file paths that match the criteria you set, such as file type and depth. Then it reads each file and turns its contents into a Data object. If you turn on multithreading, the component will read several files at the same time to speed up the process. If any file can’t be read, you can choose to ignore the error instead of stopping the whole operation.

Inputs

  • Path: Path to the directory to load files from.
  • Depth: Depth to search for files.
  • Load Hidden: If true, hidden files will be loaded.
  • Max Concurrency: Maximum concurrency for loading files.
  • Recursive: If true, the search will be recursive.
  • Silent Errors: If true, errors will not raise an exception.
  • Types: File types to load. Leave empty to load all types.
  • Use Multithreading: If true, multithreading will be used.

Outputs

  • Data: A list of Data objects, each containing the contents of one file that matched the search criteria.

Usage Example

  1. Drag the Directory component onto the canvas.
  2. In the Path field, click the folder icon and select the folder you want to scan.
  3. Set Types to *.txt if you only want text files, or leave it blank to load everything.
  4. If you want to include hidden files, toggle Load Hidden on.
  5. Click Run.
  6. The component will output a list of Data objects that you can feed into a Text Splitter or File Reader component to process the file contents further.
  • File Reader – Reads the contents of a single file.
  • Text Splitter – Splits large text data into smaller chunks.
  • Data Cleaner – Cleans or normalizes text data before analysis.

Tips and Best Practices

  • Use Depth to limit the search to a specific folder level and keep the operation fast.
  • Enable Use Multithreading only if you have many files; otherwise, it may add unnecessary overhead.
  • Keep Silent Errors off during development so you can see which files are causing problems.
  • If you only need a few file types, specify them in Types to reduce memory usage.

Security Considerations

  • The component reads files from the path you provide, so make sure the folder is safe and contains only files you intend to process.
  • Hidden files can contain sensitive data; enable Load Hidden only when you know the contents are safe.
  • Avoid using the component with paths that point to system directories or user home directories unless you understand the security implications.