From 8fd075c7124a74e46341cad1c2d1b24f0937af4c Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Wed, 25 Nov 2015 22:48:29 -0500 Subject: Simplify photos check. --- import/photobox_import2.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/import/photobox_import2.sh b/import/photobox_import2.sh index c559a14..8108bcc 100755 --- a/import/photobox_import2.sh +++ b/import/photobox_import2.sh @@ -23,20 +23,17 @@ readonly pending_path="$(make_unique $pending_root/$(date +%Y-%m-%d))" ( flock -x -w 120 200 || exit 1 - if [[ $input != *Kingston* && $input != *EOS* ]]; then - echo "Not on the SD card reader: $input" - exit 1 - fi - if [[ -z $(find "$input" -type f -print -quit | head) ]]; then - echo "No files found. Exiting." - umount $input - exit 0 + if [[ ! -d "$backup_path/DCIM" && \ + -z $(find "$backup_path/DCIM" -iregex "$photoregex" -print -quit | head) ]]; then + echo "No photos found on $input" + exit 0 fi mkdir -p "$backup_path" rsync -Hvax "$input/." "$backup_path/." echo "Contents backed up to: $backup_path" + # TODO: Remove this check after confirming that the above check works. if [[ -d "$backup_path/DCIM" && \ -n $(find "$backup_path/DCIM" -iregex "$photoregex" -print -quit | head) ]]; then echo "Found photos" -- cgit v1.2.3