Gphoto2

Aus SchnallIchNet
(Weitergeleitet von Bash/gphoto2)
Wechseln zu: Navigation, Suche


Get all pictures from digital camera

#!/bin/bash                                                                    
#                                                                              
# get all photos of cam to                                                     
# cwd or to given path...                                                      
#                                                                              

DESTPATH=""
FILES=""   

if [ -z "$1" ]; then
        echo -n "Enter destination directory to store images (default cwd): "; read HLP;
else                                                                                    
        HLP=$1;                                                                         
        echo -n "Using $HLP as destination?"; read HLP2;                                
fi                                                                                      

if [ -z "$HLP" ]; then
        DESTPATH=`/bin/pwd`
else                       
        DESTPATH=$HLP;     
fi                         

if [ ! -z "$DESTPATH" -a -d $DESTPATH ]; then
        cd $DESTPATH                         
else                                         
        echo -n "Seems destination DIR does not exist! Press ENTER to create it?"; read HLP;                                                                                    
        mkdir -p $DESTPATH;                                                             
        cd $DESTPATH;                                                                   
fi

# list files if any
echo "Checking for files on Camera... please wait..."
FILES=`/usr/bin/gphoto2 --list-files 2> /dev/null | egrep '#[0-9]*.*'`

if [ -z "$FILES" ]; then
        echo "No files found on cam. Cam powered on?";
        exit 1;
else
        echo "Found the following files on cam:";
        echo "=================================";
        echo -e $FILES | tr '#' '\n#';
        echo;
        echo -ne "Press ENTER do download files to:\n$DESTPATH  "; read HLP;
fi

/usr/bin/gphoto2 --get-all-files

### EOF ###