# 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.

URL: https://thuyavan.netlify.app/projects/directory-tree-tools
Updated: 2026-10-12

- Period: 2024 → 2025
- Technologies: 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).
