A Go CLI tool that concatenates files from a directory tree into a single .txt file — great for feeding codebases into LLMs, code reviews, or archiving.
filedump/
├── main.go # Entry point
├── go.mod
├── Makefile
├── README.md
├── cmd/
│ └── root.go # Flag parsing → Config → run
└── internal/
├── config/
│ └── config.go # Config struct
├── walker/
│ └── walker.go # Directory walking + filtering
├── dumper/
│ └── dumper.go # Writes files to output
└── tree/
└── tree.go # ASCII directory tree renderer
go build -o filedump .
# or globally
go install .| Flag | Default | Description |
|---|---|---|
-root |
. |
Root directory to scan |
-out |
dump.txt |
Output file path |
-ext |
(all) | Extensions to include (e.g. .go,.ts). Repeat or CSV. |
-include-dirs |
(all) | Whitelist directories. Relative to -root or absolute. |
-exclude-dirs |
(none) | Blacklist directories. Relative to -root or absolute. |
-exclude-files |
(none) | Exact filenames to skip (e.g. go.sum,.env). |
-tree |
false |
Prepend an ASCII directory tree to the dump. |
-v |
false |
Verbose: print each file as it's added. |
# Dump everything in current dir
filedump
# Go + Markdown only, with dir tree at top
filedump -ext .go,.md -tree
# Only scan src/ and internal/, exclude testdata/
filedump -include-dirs src,internal -exclude-dirs testdata
# Full example
filedump \
-root ./myproject \
-out snapshot.txt \
-ext .go,.ts,.tsx \
-include-dirs src,internal \
-exclude-dirs node_modules,dist,testdata \
-exclude-files go.sum,.env \
-tree \
-vWith -tree, the dump starts with a directory tree:
DIRECTORY STRUCTURE: ./myproject
├── internal/
│ ├── config/
│ │ └── config.go
│ └── walker/
│ └── walker.go
└── main.go
================================================================================
FILE: internal/config/config.go
================================================================================
package config
...
Without -tree, it goes straight to file contents.
-include-dirs |
-exclude-dirs |
Behavior |
|---|---|---|
| ✅ set | ❌ not set | Only scan listed dirs |
| ❌ not set | ✅ set | Scan everything except listed dirs |
| ✅ set | ✅ set | Scan included dirs, subtract excluded ones |
| ❌ not set | ❌ not set | Scan all (hidden dirs like .git auto-skipped) |