aboutsummaryrefslogtreecommitdiff
path: root/sync-to-kobo
blob: 8d628591d01557e83b071610315e44b14456c70d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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\""