aboutsummaryrefslogtreecommitdiff
path: root/sync-to-kobo
blob: edfabf12da34024f7c9b0fc3dca748fa9844c57e (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
#!/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
lftp -c "open sftp://kobo && mirror -X *.sdr --delete -L -R \"$BASEFOLDER/$COLLECTION\" \"/mnt/sd/$COLLECTION\""