rob miller -- rob at janerob dot com

this is another quick perl script to do a common task with my canon 30d image files. for regular work and access I like to have the images in year-month-day named directories, which at the very least comes out nicely on most listings. at the same time I want backups on dvd, and it is a tedious instance of the knapsack problem fitting the date-based dir sets together to reasonably fill a 4-ish gb disk.

so this code does it twice:

this creates in photos/rob a subdir named e.g. 2007-2-14 (or 2007-2-14_1 etc. as needed for each download of a cf card), plus creates /data2/photos-dvd/d1 ... dn as needed eanch containing just img files up to 4.3*1024*1024*1024 bytes, which is what I've found can fit on a dvd.

as it runs it also reports the size of the dvd dirs:

targ subdir  d1 : 4613742592 bytes  img_8195.jpg 2006:10:29 18:04:57 .. img_9691.jpg 2006:12:27 20:02:48
targ subdir  d2 : 2202263552 bytes  img_0001.jpg 2007:01:14 03:40:52 .. img_9999.jpg 2007:01:14 02:38:16

so you can see how many dvds will be needed and the file number and date ranges to label each dvd with.

clearly I've just wrapped around 10,000 photos so the file number range on the second entry isn't accurate, but I can probably handle that occasionally!

no doubt you'll need to modify this for your own use, in particular the location of the for-dvd storage directories and possibly the regular expresion to match the image file names depending on your camera model and its file naming scheme. these variables should be easy to find and modify at the top of the perl file. I've only just started dabbling with raw files, this is currently for jpegs.

update 03 Mar 2007: ok, now it will also place raw .cr2 files in the backup dir (just change the regex at the top of the file). having played with ufraw a bit, I'm sold.

run with no arguments for some usage instructions. requires Image::ExifTool

I hope you find img2dvd useful.


3 March 2007