aboutsummaryrefslogtreecommitdiff
path: root/sync-to-kobo
diff options
context:
space:
mode:
Diffstat (limited to 'sync-to-kobo')
-rwxr-xr-xsync-to-kobo28
1 files changed, 28 insertions, 0 deletions
diff --git a/sync-to-kobo b/sync-to-kobo
new file mode 100755
index 0000000..8d62859
--- /dev/null
+++ b/sync-to-kobo
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# A mini-wrapper to sync a local folder into kobo.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+BASEFOLDER="$HOME/data/doc"
+COLLECTION="$*"
+
+# Check
+if [ -z "$COLLECTION" ]; then
+ echo "usage: $BASENAME <colletion>"
+ echo "available base collections:"
+ echo ""
+ ls $BASEFOLDER
+ exit 1
+fi
+
+# Ensure collection exists
+if [ ! -d "$BASEFOLDER/$COLLECTION" ]; then
+ echo "error: no such collection $COLLECTION at $BASEFOLDER"
+ exit 1
+fi
+
+# Dispatch
+# Use --exclude with a egrep regexp
+lftp -c "open sftp://kobo && mirror --exclude=.*sdr --delete -L -R \"$BASEFOLDER/$COLLECTION\" \"/mnt/sd/$COLLECTION\""