Wulf's Webden

The Webden on WordPress

Linux Picture Grabbing

I’m working on my pictures from last week’s camino; the first stage is getting them off the camera. Since I routinely want to copy all the photos from the camera to my machine and I want to do it as quickly as possible (saving battery power). Rather than doing this manually each time, I’ve taken advantage of the fact that my chosen operating system (Linux – Ubuntu 06.06 for those that care) allows routine tasks to be easily scripted. This is my getpictures script:

#!/bin/bash# Get pictures from digital camera## Wulf Forrester-Barker, 20050909# Wait for camera to be connectedecho -n "Waiting for camera: "until [ -e /dev/sda ];doecho -n "."sleep 1sdoneecho# Mount and grab picturessleep 1secho "Connecting to camera"sleep 1smount /media/usbmemsleep 1secho "Connected to camera"cd /home/wulf/docs/imagesecho -n "Copying pictures: "for picture in /media/usbmem/dcim/100_fuji/*;docp -i $picture .echo -n "."doneecho# Tidy upumount /media/usbmemecho "You can now disconnect the camera"

Some of the details will have to be adjusted based on how the camera appears to your system, where the pictures are stored and where you want to copy them to. However, it is tried and tested and has some refinements such as dots echoed to the screen to show progress. Feel free to borrow and adapt for your own use.

Technorati Tags:

Comments are closed.