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/shexport 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----------
You might also like
If you like this post then please subscribe to my full RSS feed. You can also click here to subscribe by email. There are also my fabulous photos and funny videos to explore too!

Pingback: hendrin.org » Blog Archive » Card Reader Script…