host=Xiaomi_SDM439-QRD__SN%3AE77E9453_c645cda90006
cd "${0%/*}"
set -eux
-gio mount -l | grep mtp://"$host" ||
-gio mount mtp://"$host"/"Carte SD SanDisk"/
+uid=$(id -u)
year=${year:-$(date +%Y)}
-
# FIXME: handle previous year on new year
+
+gio mount -l | grep file:///run/media/"$USER"/3634-6462 ||
+gio mount file:///run/media/"$USER"/3634-6462 || true
+
mkdir -p "$year"/src
-for month in {01..12}; do
- rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
- --size-only \
- --include "???_$year$month*" --exclude '*' \
- /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/DCIM/Camera/ \
- /run/user/"$(id -u)"/gvfs/mtp:host="$host"/"Carte SD SanDisk"/DCIM/Camera/ \
- "$year"/src/"$month"
+for month in {01..12}; do
+ for src in \
+ /run/media/"$USER"/3634-6462/DCIM/ \
+ /run/user/"$uid"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé"/DCIM/Camera/ \
+ /run/user/"$uid"/gvfs/mtp:host="$host"/"Carte SD"/DCIM/Camera/
+ do
+ test ! -e "$src" ||
+ find "$src" -type f -name "???_$year$month*" -print0 |
+ rsync -ai0 --no-inc-recursive --info=progress2 --inplace --partial \
+ --size-only \
+ --files-from - --no-relative \
+ / "$year"/src/"$month"
+ done
done