Hard-Sync-CLI is a fast and lightweight command-line tool for synchronizing two directories, written in Rust. It offers powerful features, including support for dry runs, file exclusion, and reverse syncing, making it a practical solution for anyone looking to manage file syncing efficiently.
- Speed and Simplicity: Written in Rust, ensuring fast and reliable performance.
- Customization: Allows file exclusion and dry-run testing to give you full control.
- Learning Project: Built as a hands-on project to explore Rust programming while solving a real-world problem.
- Prerequisites: Install Rust and Cargo (Get Rust).
- Clone this repository:
git clone https://github.com/your-username/hard-sync-cli.git cd hard-sync-cli
- Install the tool globally:
cargo install --path .
- Confirm the installation:
hsync --help
Prebuilt binaries will be available on the Releases Page.
To display the help message:
hsync --help
The sync
command synchronizes files between two directories.
hsync sync --src <source_directory> --dest <destination_directory>
Option | Short-Hand | Description |
---|---|---|
--src <path> |
-s <path> |
Source directory to sync from. |
--dest <path> |
-d <path> |
Destination directory to sync to. |
--init |
-i |
Initialize the destination directory for syncing. |
--reverse |
-r |
Reverse the source and destination directories. |
--dry-run |
-dr |
Perform a dry run to show what changes would be made without syncing files. |
--exclude <...> |
-e <...> |
Exclude specific files or directories during sync. Supports multiple entries. |
- First-Time Sync:
hsync sync -s /path/to/source -d /path/to/destination -i
- Dry Run:
hsync sync -s /path/to/source -d /path/to/destination -dr
- Exclude Files:
hsync sync -s /path/to/source -d /path/to/destination -e "*.tmp" "ignore-this-folder/"
- Reverse Sync:
hsync sync -s /path/to/source -d /path/to/destination -r
You can specify files or directories to exclude from syncing by creating a hard_sync.ignore
file in the destination directory. The syntax is the same as a .gitignore
file.
# Ignore all .tmp files
*.tmp
# Ignore a specific folder
ignore-this-folder/
# Ignore a specific file
do-not-sync.txt
- File Syncing: Sync files and directories from a source to a destination with support for initialization and reverse syncing.
- Dry Run: Preview changes without applying them.
- File Exclusion: Specify files or directories to exclude using the
--exclude
option or anhard_sync.ignore
file. - Metadata Initialization: Use the
--init
flag to set up the destination directory for syncing. - Colorized Output: Get detailed status information with color-coded messages for errors, successes, and warnings.
- Bidirectional Syncing: Synchronize changes in both directions (
source ↔ destination
). - Network Support: Enable syncing over SSH or SFTP.
- Versioning: Create backups or versions of overwritten files.
- Configuration Files: Support for
.toml
or.json
configuration files for advanced settings.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Follow these steps to contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/your-feature-name
). - Commit your changes (
git commit -m "Add your message"
). - Push to your fork (
git push origin feature/your-feature-name
). - Open a pull request.
- Add dry-run functionality.
- Add file exclusion via CLI and ignore files.
- Add tests (unit and integration).
- Support bidirectional syncing.
- Improve error handling and logging.
- Provide prebuilt binaries for major platforms.
- Add support for syncing over a network.
Enjoy using Hard-Sync-CLI! If you encounter any issues, feel free to open an issue on GitHub. 😊