find deleted files
Sometimes you want to compare an archive backup drive and a target folder and see what items got deleted in that folder. Useful if you have a flaky backup system like dropbox. #!/usr/bin/env bash # find_deleted.sh — list non-image files that exist in SOURCE but not in TARGET # usage: ./find_deleted.sh [--rsync-check] SOURCE_DIR TARGET_DIR set -euo pipefail usage() { echo "Usage: $0 [--rsync-check] SOURCE_DIR TARGET_DIR" >&2 exit 1 } RSYNC_CHECK=0 if [ "${1:-}" = "--rsync-check" ]; then RSYNC_CHECK=1 shift fi [ $# -eq 2 ] || usage SRC="${1%/}" DST="${2%/}" [ -d "$SRC" ] || { echo "Source not found: $SRC" >&2; exit 2; } [ -d "$DST" ] || { echo "Target not found: $DST" >&2; exit 3; } # Returns 0 if the path looks like an image, 1 otherwise. is_image_path() { # lower-case path (Bash-only ${var,,}) local p="${1,,}" case "$p" in *.jpg|*.jpeg|*....