Commit dbd9b568 authored by Nico Schottelius's avatar Nico Schottelius

check for destination before mkdir

Signed-off-by: default avatarNico Schottelius <nico@brief.schottelius.org>
parent a4f5588e
......@@ -21,15 +21,22 @@
# Synchronise Camera (CF/SD/...) card with a new folder of today's date
#
set -e
set -ex
dev="$1"
dest=~nico/photos/$(date +%Y%m%d).eingehend
destbase=~nico/photos/
dest=$destbase/$(date +%Y%m%d).eingehend
#dest=~nico/$(date +%Y%m%d).eingehend
mp="/mnt"
if [ ! -e "$destbase" ]; then
echo "base $destbase not existing" >&2
exit 1
fi
mkdir -p "$dest"
mount "$dev" "$mp"
mv "$mp/DCIM/"*/* "$dest"
umount "$mp"
chown -R nico "$dest"
sudo mount "$dev" "$mp" -o uid=nico
mv -i "$mp/DCIM/"*/* "$dest"
sudo umount "$mp"
sudo chown -R nico "$dest"
su nico -c "cd $dest && renrot IMG_*.*"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment