DirXtract is a simple tool created to quickly export a file tree of a selected directory and the contents of selected files in a structured text format. It’s designed for working with text-based LLMs, making it easy to provide code files and directory structures in a way that’s readable and useful for AI models.
- Generates a text-based directory tree of your codebase.
- Lets you select which files and folders to include.
- Exports file contents along with the structure in a clean format.
- Has a "Copy to Clipboard" button for quick pasting into AI chats.
- Customizable setting to exclude specific files, folders or extensions that you never want to see in the file tree (eg.
.DS_Store).
-
Install dependencies:
pip install PyQt5
-
Run the program:
python DirXtract.py
- Select a Folder – Pick the directory you want to export.
- Adjust Selections – Use checkboxes to include/exclude files.
- View File Tree – See a structured text version of your directory.
- Export with Contents – Output the file tree along with file contents.
- Copy to Clipboard – Quickly paste the output where you need it.
-----------------------------
└── DirXtract/
├── config/
│ └── global_ignore.json
├── Dirxtract.py
├── AnotherDIR
│ └── Dirb.py
├── README.md
└── WOW.md
<DirXtract/config/global_ignore.json>
[
".DS_Store",
".git",
"__pycache__",
"*.tmp",
"CNAME",
".gitignore",
"test"
]
</DirXtract/config/global_ignore.json>
<DirXtract/Dirxtract.py>
Rest of files...
I got tired of manually copying and pasting code when asking LLMs for help. This just makes it easier to package up a project, send it to an AI, and get useful responses without missing context.
This code is provided as-is, with no guarantees or restrictions. Use it however you like with no restriction.
- MitchBoss - GitHub Profile