Skip to content

Commit

Permalink
dlphoto: Check we got back the right number
Browse files Browse the repository at this point in the history
  • Loading branch information
cdown committed Oct 28, 2023
1 parent efe49ba commit 0178e64
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion bin/dlphoto
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -ex

shopt -s nullglob

dir=${1?missing dir}
shift

Expand All @@ -9,4 +11,16 @@ for file; do
includes+=( --include "$file" )
done

rclone copy gs:chris-down-photos/chrisdown-photos/"$dir" . "${includes[@]}"
temp_dir=$(mktemp -d)

rclone copy gs:chris-down-photos/chrisdown-photos/"$dir" "$temp_dir"/ "${includes[@]}"

local_files=( "$temp_dir"/* )

if (( "$#" != "${#local_files[@]}" )); then
printf '%s\n' 'Got back wrong number of files' >&2
exit 1
fi

mv "${local_files[@]}" .
rmdir "$temp_dir"

0 comments on commit 0178e64

Please sign in to comment.