2 host=Xiaomi_SDM439
-QRD__SN%3AB0796589_c7565cf60006
7 year
=${year:-$(date +%Y)}
8 # FIXME: handle previous year on new year
10 if gio mount
-l | grep file:///run
/media
/"$USER"/disk
||
11 gio mount
file:///run
/media
/"$USER"/disk
13 find /run
/media
/julm
/disk
/DCIM
/ -type f
-not -name "IMG_*" -not -name "VID_*" |
14 while read -r file; do
15 #--remove-source-files
17 case $(file --mime-type "$file") in
18 *:\ video
/*) prefix
=VID
;;
19 *:\ image
/*) prefix
=IMG
;;
21 # rsync -ai --no-inc-recursive --info=progress2 --inplace --partial
22 out
=$(date -r "$file" +"$(dirname "$file")/${prefix}_
%Y
%m
%d_
%H
%M
%S
")
23 test "$file" = "$out.
$ext" ||
24 mv -n "$file" "$out.
$ext" ||
25 { i=1; while ! mv -n "$file" "${out}_
$i.
$ext"; do i=$((i+1)); done; }
29 if gio mount -l | grep mtp://"$host" ||
30 gio mount mtp://"$host"/"Carte SD SanDisk
"/
32 mkdir -p "$year"/audio/src
33 test ! -d /run/user/"$uid"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé
"/MIUI/sound_recorder ||
34 rsync -ai --no-inc-recursive --info=progress2 --inplace --partial \
35 --remove-source-files \
36 /run/user/"$uid"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé
"/MIUI/sound_recorder \
41 gio mount -l | grep file:///run/media/"$USER"/6365-3561 ||
42 gio mount file:///run/media/"$USER"/6365-3561 || true
45 for month in {01..12}; do
47 /run/media/"$USER"/disk/DCIM/ \
48 /run/media/"$USER"/6365-3561/DCIM/ \
49 /run/user/"$uid"/gvfs/mtp:host="$host"/"Espace de stockage interne partagé
"/DCIM/Camera/ \
50 /run/user/"$uid"/gvfs/mtp:host="$host"/"Carte SD SanDisk
"/DCIM/Camera/
53 find "$src" -type f -name "???_
$year$month*" -print0 |
54 rsync -ai0 --no-inc-recursive --info=progress2 --inplace --partial \
55 --remove-source-files \
56 --files-from - --no-relative \
57 / "$year"/src/"$month"