better sync
This commit is contained in:
@@ -10,24 +10,34 @@
|
||||
# Adjust SHARE and SUBPATH to match your environment.
|
||||
|
||||
RECURSIVE=""
|
||||
SUBDIR=""
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help|-h)
|
||||
cat <<'EOF'
|
||||
Usage: sync-pictures [options]
|
||||
Usage: sync-pictures [options] [<subdir>]
|
||||
|
||||
Sync ~/Pictures to a NAS share and run neatcli organize on both ends.
|
||||
Sync ~/Pictures (or a subdirectory) to a NAS share and run neatcli organize on both ends.
|
||||
|
||||
Options:
|
||||
-r, --recursive Sync subdirectories recursively (default: top-level files only)
|
||||
-r, --recursive Sync recursively (default: top-level files only)
|
||||
-h, --help Show this help message and exit
|
||||
|
||||
If <subdir> is given, sync only that subdirectory relative to ~/Pictures.
|
||||
Use '.' to refer to ~/Pictures itself.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
--recursive|-r)
|
||||
RECURSIVE=1
|
||||
;;
|
||||
*)
|
||||
[ -z "${SUBDIR}" ] && SUBDIR="${arg}" || {
|
||||
echo "[sync-pictures] ERROR: Unexpected argument: ${arg}"
|
||||
exit 1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -36,6 +46,10 @@ SUBPATH="Pictures"
|
||||
MOUNTPOINT="${HOME}/mnt/miniShare1"
|
||||
CREDENTIALS="${HOME}/.smb/mini.nas"
|
||||
SOURCE="${HOME}/Pictures"
|
||||
if [ -n "${SUBDIR}" ] && [ "${SUBDIR}" != "." ]; then
|
||||
SOURCE="${SOURCE}/${SUBDIR}"
|
||||
SUBPATH="${SUBPATH}/${SUBDIR}"
|
||||
fi
|
||||
START="$(date +%s)"
|
||||
|
||||
echo "[sync-pictures] Starting at $(date)"
|
||||
|
||||
Reference in New Issue
Block a user