A simple, interactive wrapper around rsync designed for developers who code locally but run on a remote server. It manages configurations automatically and prevents accidental data loss on the server.
- Zero-Config Start: Just run
wwsync <server> -sin your project folder. It will ask for details once and remember them. - Multiple Servers: Support for distinct configurations (e.g.,
production,staging,dev-server). - Safe Mode (
-s/--safe): Standard execution uploads files but never deletes anything on the server (preserving logs, build artifacts, etc.). - Interactive Full Sync (
-f/--full): The-fflag mirrors the local directory. It performs a "dry run" first, shows you exactly which files will be deleted, and asks for confirmation. - Sync All (
-a/--all): Syncs all mappings across all servers in one command. Requires--safeor--full. Asks for confirmation before each mapping. - Auto Accept (
--auto_accept): Skips all confirmations in--fulland--allmodes. - Remote Run (
-r): Automatically SSH into the server, cd to the project folder, and optionally execute a startup command (e.g.conda activate). - Exclusions: Easy management of ignored files (
node_modules,.git,.env). - General Excludes: Define exclusion patterns once in
general_excludes— they apply to all mappings on all servers automatically. - Artifacts Download (
-d/--download): Downloads only new remote files into.wwsync_<server>_artifactsinside your project. Changed files are listed as warning and are not downloaded.
- Download the script:
curl -o wwsync -L https://github.com/Batyan45/wwsync/releases/latest/download/wwsync
# OR just copy the python code into a file named 'wwsync'- Make it executable:
chmod +x wwsync- Move it to your path:
sudo mv wwsync /usr/local/bin/Run this command inside your project folder:
wwsync my-server -s- If this is your first time, it will ask for the
user@ipand theremote path. - It will sync changes to the server.
- It will NOT delete files on the server that are missing locally.
If you renamed files or cleaned up your local folder and want the server to match exactly:
wwsync my-server -f- It calculates differences.
- It displays a list of files to be deleted (e.g.,
deleting logs/old.log). - It asks for
y/nconfirmation before deleting anything.
To jump into the remote server directory (and optionally run a command):
wwsync my-server -r- Connects via SSH and
cds to the configured remote path. - If a
run_commandis configured (e.g.source .env), it executes it first. - Leaves you in an interactive shell.
Combine with sync:
wwsync my-server -s -rTo sync all configured mappings across all servers:
# Safe sync all
wwsync -a -s
# Full sync all (with confirmations)
wwsync -a -f
# Full sync all without confirmations
wwsync -a -f --auto_accept- Syncs files (Safe mode).
- Starts remote session.
wwsync my-server -d- Creates/overwrites
.wwsync_my-server_artifactsin your project directory. - Downloads only files that are new on remote.
- If remote also has changed files, prints a warning list and skips those files.
- If the artifacts folder already exists, asks for confirmation before deleting it.
The configuration is stored in ~/.wwsync in JSON format. You can edit it manually if needed.
Example structure:
{
"general_excludes": [".git", ".DS_Store", "__pycache__"],
"servers": {
"production": {
"host": "root@192.168.1.50",
"shell": "zsh",
"mappings": [
{
"local": "/Users/dev/my-project",
"remote": "/var/www/html/api",
"excludes": ["node_modules", ".env"],
"artifact_excludes": ["*.tmp", "*.cache"],
"run_command": "source .env; conda activate myenv"
}
]
}
}
}general_excludes— patterns listed here are merged with every mapping'sexcludeson every server. Duplicates are removed automatically. This is useful for patterns like.git,.DS_Store,__pycache__that you always want to exclude.excludes(per mapping) — additional patterns specific to a particular folder.
- Python 3+
rsyncinstalled on both local machine and remote server.- SSH access to the remote server.