aboutsummaryrefslogtreecommitdiff
path: root/davcpy.sh
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-20 10:51:27 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-02-20 10:51:56 +0100
commit6f6a16cdd2a49f7b50e8b0d2b75ef768a323eee7 (patch)
tree20850a9c3bec2cd17c7b3397a14da6fbaae3534b /davcpy.sh
parente9614e563a19907494020971b4620b657c2e11cf (diff)
downloadpdf-as-4-6f6a16cdd2a49f7b50e8b0d2b75ef768a323eee7.tar.gz
pdf-as-4-6f6a16cdd2a49f7b50e8b0d2b75ef768a323eee7.tar.bz2
pdf-as-4-6f6a16cdd2a49f7b50e8b0d2b75ef768a323eee7.zip
Added WebDAV upload script for cadaver, fixed docs dir
Diffstat (limited to 'davcpy.sh')
-rwxr-xr-xdavcpy.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/davcpy.sh b/davcpy.sh
new file mode 100755
index 00000000..99a47b6d
--- /dev/null
+++ b/davcpy.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+usage () { echo "$0 <src> <cadaver-args>*" >/dev/stderr; }
+error () { echo "$1" >/dev/stderr; usage; exit 1; }
+
+test $# '<' 3 || \
+ error "Source and cadaver arguments expected!";
+
+src="$1"; shift;
+test -r "$src" || \
+ error "Source argument should be a readable file or directory!";
+
+cd "$(dirname "$src")";
+src="$(basename "$src")";
+root="$(pwd)";
+rc="$(mktemp)";
+{
+ find "$src" '(' -type d -a -readable ')' \
+ -printf 'mkcol "%p"\n';
+ find "$src" '(' -type f -a -readable ')' \
+ -printf 'cd "%h"\nlcd "%h"\n' \
+ -printf 'mput "%f"\n' \
+ -printf 'cd -\nlcd "'"$root"'"\n';
+ echo "quit";
+} > "$rc";
+
+cadaver -r "$rc" "$@";
+rm -f "$rc";