simple script for pulling photos from a camera
authortridge <>
Tue, 16 Dec 2003 00:42:52 +0000 (00:42 +0000)
committertridge <>
Tue, 16 Dec 2003 00:42:52 +0000 (00:42 +0000)
photos_grab [new file with mode: 0755]

diff --git a/photos_grab b/photos_grab
new file mode 100755 (executable)
index 0000000..d4b9ab4
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+mkdir -p $HOME/photos/s40
+
+cd $HOME/photos/s40 || exit 1
+
+LIST=`gphoto2 --port usb -L 2> /dev/null | grep '^#' | awk '{print $2}'`
+
+if [ -z "$LIST" ]; then
+    echo no photos
+    exit 1
+fi
+
+n1=1
+n2=0
+for f in $LIST; do
+    n2=`expr $n2 + 1`;
+    if [ ! -f $f ]; then
+       echo $f
+    else
+       echo Already have $f
+       if [ $n2 -eq $n1 ]; then
+           n1=`expr $n2 + 1`
+       fi
+    fi
+done
+
+if [ $n2 -ge $n1 ]; then
+  gphoto2 --port usb -p $n1-$n2
+fi
+
+echo -n 'delete photos? [y/N] '
+read ans
+if [ "$ans" = y ]; then
+    gphoto2 --port usb -D
+fi