add recursive to sync-pictures

This commit is contained in:
2026-06-14 16:37:20 -07:00
parent 204880508b
commit 4a0b01d7a8

View File

@@ -9,6 +9,8 @@
#
# Adjust SHARE and SUBPATH to match your environment.
RECURSIVE=""
for arg in "$@"; do
case "$arg" in
--help|-h)
@@ -18,10 +20,14 @@ Usage: sync-pictures [options]
Sync ~/Pictures to a NAS share and run neatcli organize on both ends.
Options:
-r, --recursive Sync subdirectories recursively (default: top-level files only)
-h, --help Show this help message and exit
EOF
exit 0
;;
--recursive|-r)
RECURSIVE=1
;;
esac
done
@@ -55,11 +61,14 @@ fi
# 2. One-way rsync contents of ~/Pictures → share subpath
MP="${MOUNTPOINT}/${SUBPATH}"
echo "[sync-pictures] Syncing ${SOURCE}/ → ${MP}/"
rsync -vu --exclude='*/' \
RSYNC_FLAGS=(-vu --progress --stats --exclude=".DS_Store")
if [ -z "${RECURSIVE}" ]; then
RSYNC_FLAGS+=(--exclude='*/')
fi
rsync "${RSYNC_FLAGS[@]}" \
"${SOURCE}/" \
"${MP}/" \
--progress --stats \
--exclude=".DS_Store"
"${MP}/"
# 3. Run neatcli organize on both source and dest
if command -v neatcli &>/dev/null; then