Revision 9800
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/sync.sh | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/util.sh |
|
3 |
|
|
4 |
if self_not_included; then |
|
5 |
|
|
6 |
alias use_sync='declare prefix=sync_; import_vars; unset prefix' |
|
7 |
|
|
8 |
upload() # usage: local_dir=... remote_url=server:dir upload paths... |
|
9 |
# requires put from https://uutils.googlecode.com/svn/trunk/bin/put |
|
10 |
{ |
|
11 |
echo_func; kw_params local_dir remote_url swap |
|
12 |
|
|
13 |
base_dir="$local_dir" cmd=canon_rel_path foreach_arg |
|
14 |
set -- "${@/#/--include=/}" # prepend each with --include=/ |
|
15 |
src="$local_dir" dest="$remote_url" command put "$@" --exclude="**" |
|
16 |
} |
|
17 |
pf upload |
|
18 |
|
|
19 |
download() { echo_func; swap=1 upload; } # usage: see upload() |
|
20 |
|
|
21 |
fi |
|
0 | 22 |
Also available in: Unified diff
added lib/sh/sync.sh with upload(), download()