One-way file synchronization tool written in Go.
go build -o sync ./cmd/syncmake builddocker build -t sync:latest ../sync [options] <source> <target><source>- Source directory path (required)<target>- Target directory path (required)
-d, --delete-missing- Delete files in target that don't exist in source-c, --checksum- Compare files using SHA256 checksum (slower but more accurate)-h, --help- Show help message
# Basic synchronization
./sync /path/to/source /path/to/target
# Delete files in target that don't exist in source
./sync -d /path/to/source /path/to/target
# Use SHA256 checksum for comparison (more accurate)
./sync -c /path/to/source /path/to/target
# Combine flags
./sync -d -c /path/to/source /path/to/target# Run with mounted volumes
docker run --rm \
-v /path/to/source:/source:ro \
-v /path/to/target:/target \
sync:latest /source /target
# With delete-missing flag
docker run --rm \
-v /path/to/source:/source:ro \
-v /path/to/target:/target \
sync:latest -d /source /target- Scans the source directory recursively
- For each file in source:
- If file doesn't exist in target → copy
- If file exists → compare (by size/modtime or SHA256 checksum) → update if different
- If
--delete-missingis enabled:- Scans target directory
- Deletes files that don't exist in source
- Default (metadata): Compares file size and modification time. Fast but may miss files with same size/time but different content.
- Checksum (
-c): Compares SHA256 hash of file contents. Slower but guarantees detection of any content difference.
make build # Build binary for current platform
make test # Run tests
make clean # Remove build artifacts
make build-docker # Build Docker image
make build-all # Build multi-platform Docker images (requires buildx)
make dist # Build binaries for all platformsBuild binaries for all supported platforms:
make distThis creates binaries in dist/ directory:
sync-linux-amd64sync-linux-arm64sync-darwin-amd64sync-darwin-arm64sync-windows-amd64.exe
Build Docker images for multiple platforms using buildx:
make build-allSupported platforms:
linux/amd64linux/arm64darwin/amd64darwin/arm64windows/amd64
go test ./...
# or
make test