25 stable releases
new 1.3.4 | May 14, 2025 |
---|---|
1.3.3 | May 10, 2025 |
1.2.0 | Mar 18, 2025 |
1.1.1 | Feb 16, 2025 |
#391 in Filesystem
2,270 downloads per month
29KB
583 lines
sync-rs
A simple tool for syncing local directories to remote servers using rsync and SSH.
Features
- Sync local directories to remote servers using rsync
- Support for multiple remote configurations per directory
- Automatic .gitignore filtering
- Post-sync command execution
- Interactive remote shell access
- Preferred remote selection for automatic use
- Cache-based configuration management
Installation
cargo install sync-rs
Usage
Basic usage:
sync-rs user@host remote_dir
Command Line Options
-o, --override-path
: Additional paths to sync (can specify multiple)-c, --post-command
: Post-sync command to execute-s, --shell
: Open an interactive shell in the remote directory after syncing-n, --name
: Name for this remote configuration (used when managing multiple remotes)-l, --list
: List all remote configurations for the current directory-r, --remove
: Remove a remote configuration by name-d, --delete-override
: Enable delete mode for override paths (default: disabled)-P, --preferred
: Set this remote as the preferred one for this directory
Examples
- Sync to a remote server:
sync-rs user@host remote_dir
- Sync with additional paths and post-sync command:
sync-rs user@host remote_dir -o path1 -o path2 -c "npm install"
- Open an interactive shell after syncing:
sync-rs user@host remote_dir -s
- Create a named remote configuration:
sync-rs user@host remote_dir -n my-remote
- List all remote configurations:
sync-rs -l
- Remove a remote configuration:
sync-rs -r my-remote
- Set a remote as preferred:
sync-rs -n my-remote -P
Preferred Remotes
When you have multiple remote configurations for a directory, you can set one as preferred:
- Set a remote as preferred:
sync-rs -n my-remote -P
- List remotes to see which one is preferred:
sync-rs -l
When running sync without specifying a remote, it will automatically use the preferred remote if one exists. If no preferred remote is set, it will prompt you to select one.
Requirements
- Unix-like environment (Linux or macOS)
- rsync
- SSH
License
MIT
Dependencies
~2–13MB
~96K SLoC