Daily Archives: July 13, 2005

Linux: Auto-mounting USB camera memory

I have 2 cameras. One takes Flash cards, the other takes SD cards. If my Sony still worked, I’d also add memory sticks to that list.
I’ve got a routine, a workflow, for copying photos off camera media but it’s slightly more complicated with multiple memory types!
Kevin Lyda kindly mailed me a script he had for auto-mounting his camera and copying the files off. It uses the usb hotplug program to do that but I couldn’t get it to work with my card reader so I wrote the following script. Bits of it are from Kevin’s scipt, so thanks!
I insert my camera media, and run “copyfromcamera.sh” and it find the Flash card and copies all files off it into a directory with today’s date!

Make sure you have your media mount points setup in /etc/fstab. Here’s what mine looks like:

----------/etc/fstab----------
/dev/sdb1 /mnt/cfcard vfat users,noauto,rw,uid=1000 0 0
/dev/sdd1 /mnt/sdcard vfat users,noauto,rw,uid=1000 0 0
----------/etc/fstab----------

Copy and paste this into a file and save it to /usr/local/bin/copyfromcamera.sh and make it executable (chmod 755 /usr/local/bin/copyfromcamera.sh)

----------/usr/local/bin/copyfromcamera.sh----------
#!/bin/sh

export YEAR=`date +%Y`
export TODAY=`date +%Y-%m-%d`
export DIR=/home/donncha/Photos/$YEAR/$TODAY/
mount /mnt/cfcard/ 2> /dev/null
if [ -d /mnt/cfcard/dcim/ ]; then
    mkdir -p $DIR
    find /mnt/cfcard/dcim -type f -print0 | xargs -0i mv -vi '{}' $DIR
    umount /mnt/cfcard/
    df -h
fi
mount /mnt/sdcard/ 2> /dev/null
if [ -d /mnt/sdcard/dcim/ ]; then
    mkdir -p $DIR
    find /mnt/sdcard/dcim -type f -print0 | xargs -0i mv -vi '{}' $DIR
    umount /mnt/sdcard/
    df -h
fi
----------/usr/local/bin/copyfromcamera.sh----------

The Digital Journalist – July 2005

A bit late this month, but Dirck Halstead the July 2005 edition The Digital Journalist is out.
It has plenty to read, including a good article on the emergence of “citizen-journalists” armed with camera phones.

Photojournalism history was made last week. For the first time, both The New York Times and the Washington Post ran photos on their front pages made by citizen-journalists with camera phones.

As I was snapping the sunset in Kinsale last night with my cumbersome 20D, swapping lenses, and swearing when I realised I had left my second memory card at home, someone else got out of their car, hopped up on the ditch and pointed their phone to the west. Somehow I can’t imagine it matched my 300mm zoom, but the future is now!