# dumpfiles
`dumpfiles` is a Rust command-line tool to generate a structured YAML representation of a directory's contents, including metadata and the contents of text files.
It's designed to make it easy to share an entire code repository or any set of text files to an LLM (GPT-4o, Claude, etc.) for analysis or documentation.
## Features
- YAML Output: Generates a structured YAML file with file paths, sizes, token counts and contents.
- Integrates with `.gitignore` files, ie. it will ignore files specified in `.gitignore`
- Supports custom additional ignore patterns using the same syntax as `.gitignore` files, in a `.dumpignore` file
## Installation
To install `dumpfiles`, you need to have Rust and Cargo installed on your system. Then, you can build the project from source:
```bash
cargo install dumpfiles
```
## Usage
```bash
dumpfiles [OPTIONS] <DIRECTORY>
```
This will scan `<directory>` and output a `output.yaml` file.
### Arguments
- `<DIRECTORY>`: Path to the directory to process
### Options
- `-o, --output <FILE>`: Path to the output file (default: "output.yaml")
- `-g, --gitignore <FILE>`: Path to the .gitignore file (default: ".gitignore")
- `--no-gitignore`: Ignore the .gitignore file
- `-d, --dumpignore <FILE>`: Path to the .dumpignore file (default: ".dumpignore")
- `-i, --ignore <PATTERN>`: Additional ignore pattern (can be used multiple times)
### Example
```bash
dumpfiles src/ -o project_dump.yaml -d ../.dumpignore -i uv.lock
```
This command will process the `src` directory, ignore all files specified in the `../.dumpignore` file, and save the output to `project_dump.yaml`.
## Output Format
A generated output.yaml might look like this:
Example:
```yaml
project: my_project
files:
- path: Cargo.toml
size: "1.5 KB"
lines: 20
tokens: 50
content: |
[package]
name = "my_project"
version = "0.1.0"
- path: src/main.rs
size: "3.2 KB"
lines: 120
tokens: 500
content: |
fn main() {
println!("Hello, world!");
}
```
## Contributing
Contributions are welcome! Please feel free to submit a PR or open an issue.
## License
This project is licensed under the MIT License - see the LICENSE file for details.