dedup-go is a simple, fast, idiomatic Go tool to detect and remove duplicate files in a directory by computing their content hashes.
Itβs designed to be a lightweight, real-world example of writing robust Go CLIs and learning file I/O, hashing, and concurrency.
- Scan any target directory recursively
- Compute SHA-256 hashes for file comparison
- Report duplicates and optionally delete them
- Clean, modular Go project structure
- Ready for use as a CLI or as a library
# Clone the repo
git clone https://github.com/chishxd/dedup-go.git
# Initialize dependencies
cd dedup-go
go mod tidy
# Run the CLI
go run ./cmd/dedup.go ./path/to/your/target_dirBasic usage:
dedup-go --path ./target_dir --delete| Flag | Description |
|---|---|
--path |
Path to the directory to scan |
--delete |
Remove duplicates automatically |
dedup-go/
βββ cmd/ # CLI entry point
β βββ dedup.go
βββ internal/ # Core logic
β βββ hash.go
β βββ dedup.go
β βββ utils.go
βββ go.mod
βββ go.sum
βββ README.md
βββ LICENSE
- Add unit tests
- Add concurrency for faster hashing
- Add logging and verbose output
- Build cross-platform binaries
Pull requests are welcome! Please open an issue first to discuss major changes.
Make sure to follow Go best practices and run go fmt before submitting.
This project is licensed under the MIT License β see LICENSE for details.
Built with π by Chinmay Shet.