A command-line tool written in Go to find and manage duplicate files in a specified directory.
- Finds duplicate files based on their content hash (SHA-256).
- Recursively searches through subdirectories.
- Concurrent processing for faster hashing.
- Optimized hashing strategy (groups files by size first).
- Interactive mode to select which files to delete.
- Dry run mode to preview deletions.
- Exclude directories and file patterns.
- Filter by file type and size.
- Formatted output (text or JSON).
You can download the latest pre-built binaries for Windows, macOS, and Linux from the GitHub Releases page.
- Download the appropriate binary for your operating system from the releases page.
- Extract the archive and run the executable from your terminal.
For example, on macOS or Linux:
./bytebrush_darwin_amd64 --dir /path/to/searchOn Windows:
./bytebrush_windows_amd64.exe --dir C:\path\to\search- Go (1.23 or later)
- Clone the repository:
git clone https://github.com/gyaan/ByteBrush.git
- Navigate to the project directory:
cd ByteBrush
To build the binaries for different operating systems, use the following commands:
- Linux:
GOOS=linux GOARCH=amd64 go build -o bin/bytebrush_linux_amd64 cmd/duplicate-files/main.go
- Windows:
GOOS=windows GOARCH=amd64 go build -o bin/bytebrush_windows_amd64.exe cmd/duplicate-files/main.go
- macOS (Intel):
GOOS=darwin GOARCH=amd64 go build -o bin/bytebrush_darwin_amd64 cmd/duplicate-files/main.go
- macOS (Apple Silicon):
GOOS=darwin GOARCH=arm64 go build -o bin/bytebrush_darwin_arm64 cmd/duplicate-files/main.go
--dir: Directory to search for duplicate files (default:.)--dry-run: Print files that would be deleted without actually deleting them.--exclude: Comma-separated list of directories or file patterns to exclude.--include: Comma-separated list of file patterns to include.--min-size: Minimum file size in bytes.--max-size: Maximum file size in bytes.--format: Output format (text, json) (default:text)--interactive: Prompt for which file to keep when duplicates are found.
cmd/duplicate-files/main.go: The main application entry point.pkg/filehasher/filehasher.go: The package responsible for calculating file hashes.pkg/fileutils/fileutils.go: The package responsible for finding files and filtering them.pkg/ui/ui.go: The package responsible for the interactive user interface.go.mod: The Go module definition file.
This project uses Go's built-in testing framework. To run the tests, use the following command:
go test ./...The code is formatted using gofmt.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add some amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.