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