DirectoryLoader discovers files in a directory and loads them into LangChain Document objects, making folder-based knowledge bases easier to ingest. section 10.5.2
Load text files from a folder
Point the loader at an articles/ folder, include .txt files in nested folders, and use TextLoader for each file:\n\nloader = DirectoryLoader(\n folder_path,\n glob="**/*.txt",\n loader_cls=TextLoader\n)\ndocuments = loader.load()\n\nThe result is a list of Documents containing raw text and metadata. section 10.5.2

