wrapsync
is a wrapper script for rsync
. Its main purpose is to simplify rsync
'ing common directories.
NOTE: This project is somewhat deprecated in favour of wrapsync2.
cd wrapsync
./bin/setup.sh
Example walkthrough:
cd wrapsync
./bin/setup.sh
$ Your SSH username: amrwc
$ Remote parent directory path (full SSH URL): amrwc@ssh-amrwc.example.com:/programming
$ Remote directory path (full SSH URL): amrwc@ssh-amrwc.example.com:/programming/repositories
$ Local parent directory (prefer absolute paths): /Users/amrwc/Documents/programming
$ Local directory (prefer absolute paths): /Users/amrwc/Documents/programming/repositories
$ Rsync flags (just the letters) [aP]: P
$ Rsync excludes (wrap in quotes and separate with spaces if multiple): "node_modules vendor bin *.class"
Now that the script has been prepared, it can be used as follows:
# Example project path: /Users/amrwc/Documents/programming/repositories/coolproject
ws push coolproject --delete
# Upload all projects from the `repositories` directory to the remote server
ws push all
-
Prepare the variables inside of the
wrapsync
script file.Required:
USERNAME
– SSH login,REMOTE_PARENT_DIR_PATH
– an absolute path to the parent directory ofREMOTE_DIR_PATH
, e.g.${USERNAME}@ssh.example.com:/home/jon/Documents/repositories
; this enables syncing using theall
option,REMOTE_DIR_PATH
– an absolute path to the remote directory containing everything we may want to sync, e.g.${REMOTE_PARENT_DIR_PATH}/services
,LOCAL_PARENT_DIR_PATH
– an absolute path to the parent directory ofLOCAL_DIR_PATH
, e.g./Users/jon/Documents/repositories
; this enables syncing using theall
option,LOCAL_DIR_PATH
– an absolute path to the local directory containing everything we may want to sync, e.g.${LOCAL_PARENT_DIR_PATH}/services
.
Optional:
FLAGS
–rsync
flags; if no flags are given, this option will be omitted,EXCLUDE
– an array of patterns of file names/directory names; what matches these patterns will be excluded from synchronising; defaults to no exclusions; e.g.:
readonly EXCLUDE=( 'node_modules' 'vendor' 'bin' '*.class' )
-
Create a symlink to the script for convenience.
cd wrapsync ln -s "$(pwd)/wrapsync" /usr/local/bin/ws
-
Now the script can be used from anywhere:
ws <pull/push> <service> [options] # Examples: ws push linux --update ws pull windows --delete