pull: add mo
authorJulien Moutinho <julm@sourcephile.fr>
Sat, 6 Jan 2024 16:03:33 +0000 (17:03 +0100)
committerJulien Moutinho <julm@sourcephile.fr>
Sat, 6 Jan 2024 16:03:33 +0000 (17:03 +0100)
mo/pull.sh [new file with mode: 0755]

diff --git a/mo/pull.sh b/mo/pull.sh
new file mode 100755 (executable)
index 0000000..052a8fa
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+host=Fairphone_FP3_A209PB4N0202
+cd "${0%/*}"
+set -eux
+gio mount -l | grep mtp://"$host" ||
+gio mount mtp://"$host"/CARTE_SD/
+
+year=${year:-$(date +%Y)}
+
+mkdir -p "$year"/src
+for month in {01..12}
+do
+  rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
+    --include "???_2023${month}*" \
+    --exclude '*' \
+    /run/user/1000/gvfs/mtp:host="$host"/CARTE_SD/DCIM/Camera/ \
+    "$year"/src/"$month"
+done