]> Git — Sourcephile - julm/camera.git/blob - sevy/pull.sh
index: fix mkdir with subdirs
[julm/camera.git] / sevy / pull.sh
1 #!/usr/bin/env bash
2 host=Xiaomi_SDM439-QRD__SN%3AE77E9453_c645cda90006
3 cd "${0%/*}"
4 set -eux
5 gio mount -l | grep mtp://"$host" ||
6 gio mount mtp://"$host"/"Carte SD SanDisk"/
7
8 year=$(date +%Y)
9
10 # FIXME: handle previous year on new year
11 mkdir -p "$year"/src
12 for month in {01..12}; do
13 rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
14 --include "???_$year$month*" --exclude '*' \
15 /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/DCIM/Camera/ \
16 /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Carte SD SanDisk"/DCIM/Camera/ \
17 "$year"/src/"$month"
18 done