#!/bin/sh
#
# photosuck: extract photos from a smartmedia card via pcmcia card,
# then rename them by date using epinfo.
#
# http://impressive.net/people/gerald/2001/05/photosuck
#
# usage: photosuck [ targetdir ]
#        where targetdir is an optional target directory
#        (default is the current directory)
#
# this script assumes that you already have a smartmedia card mounted,
# the location is specified below.
# 
# Gerald Oskoboiny, 6 May 2001
#
# $Id: photosuck,v 1.5 2005/08/19 06:31:39 gerald Exp $
#

temp=".photosuck.$$"
mediadir="/sm"

if [ $# -ne 0 ]; then
    target=$1
else
    target="."
fi

cd $target
mkdir $temp
cp -rv $mediadir $temp			# epinfo -r no worky across filesystems
find $temp -type f -print | xargs chmod 0644
W=$target; export W
rename-vids `find $temp -type f -print | grep -i thm$`
rename-photos `find $temp -type f -print | grep -i jpg$`
rmdir -p --ignore-fail-on-non-empty $(find $temp -type d)

