Directory tree exporters and file listers
A family of directory-tree exporters and file listers built across 2024 and 2025 to document projects and prepare context for LLMs.
- Period
- 2024 – 2025
- Technologies
- 1
- Diagrams
- 0
- Reading time
- 1 min
Source & download: List Every File in a Folder to a Text or CSV Manifest with Python Source & download: Generate a Clean Folder Tree of Any Project with Python
Version comparison
| Feature | 1a / 1b | 2 list_structure |
3a file_lister |
3b file_lister_v2 |
|---|---|---|---|---|
| Scope | recursive tree | recursive tree | flat file list of one folder | flat list |
| Output | FolderStructure(n).txt with ` |
–` indentation | tree lines with ├─ └─ connectors + header (root, timestamp) + folder / file counts | numbered list or CSV, grouped by extension, human-readable sizes, totals |
| Config | none (cwd) | argparse (root path, extra excludes, output file) | argparse: --sort {name, created}, --format {default, csv} |
flags at the top of the file (SORT_BY, OUTPUT_FORMAT, OMIT_PY_FILES, OMIT_TXT_FILES, OMIT_FILE_SIZE): run with no arguments |
| Excludes | — | DEFAULT_EXCLUDES: .git, node_modules, .dart_tool, .gradle, .venv/venv, build, dist, __pycache__, .idea, .vscode, .pnpm-store… |
own script / txt files | configurable by flag |
| Other | non-clobbering output name | pathlib, typed (from __future__ import annotations), sorted dirs-first |
defaultdict per extension |
— |
v3b’s “edit flags, then just run” style is the owner’s stated preference (see S05’s spec: options go inside the script, not on the command line), and it recurs in later scripts.
Purpose and lineage
- 2024: map existing Flutter projects to design the S02 generator spec (doc 035).
- 2025: produce compact project trees to paste into AI assistants (hence the build / dependency excludes). This is the same need that ThuOneCopy (P22) and the copycode family (S01) answer at full-code level.
Algorithm (gen 2)
Depth-first walk. At each level children are sorted dirs-first, then by name. Excluded names are pruned before descending. Prefix strings (│ / ) are carried down to draw the tree. Counters return (lines, n_dirs, n_files).
Related projects
AI and LLM experiments
Experiments with LLM APIs: a Flask chat over several providers, speech-to-text and model tests, and a React and shadcn debugging sandbox.
PythonFastAPI / FlaskLLM integrationReact+1Bulk test-document generator and Stitch-to-PDF storyboard
Python scripts that batch-generate numbered test documents (Word to PDF, Pillow images) plus a Stitch-to-PDF storyboard for QA and design review.
PythonPDF & document generationcopyCode prototypes: 15 versions towards ThuOneCopy
Fifteen PyQt5 prototype versions of a tool that copies selected project files as one block for ChatGPT, evolving into ThuOneCopy.
PythonDesktop GUI (Tk / Qt)Want to discuss this project?
Happy to walk through the architecture, trade-offs or the code.