[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: photo management and camera download by date



jmt wrote:

On Tuesday 23 May 2006 04:09, Richard Otte wrote:
Hi,

I would like to download photos off of my digital camera in such a way
that they are sorted into directories by date.  So a photo taken on
Feb 23,2006 would be put in a directory 2006/02/23/filename.  The
camera will often have photos taken on different dates, and I'd like
the directories to be created and the photos to be organized into
these directories automatically.  Does anyone know of a program that
will do this?

I very briefly looked at digikam, but it looks as if it downloads all
the photos into an album, and the photos are not downloaded according
to date.  It looks as if I could make a digikam album for each date,
and then manually download photos to the different albums, but this
takes a fair amount of work if there are lots of photos taken on
different dates.

Any suggestions are appreciated.  Thanks,

Ric

I've looked a little further at Image::ExifTool in perl : this module has access to almost all digital camera formats, and can easily retrieve snapshot date.

jmt


Exiftool is a nice piece. I use it on my workflow with pictures, and i really like it. This is one of my scripts, a bit modified:

FILES=`ls *.NEF` # nef's are from my nikon d70s. Change accordingly.


for arg in $FILES; do
#Extracts exif info
   exiftool $arg  > exif
   #There are more than one date line on exif's:
   cat exif |grep Date|tail -n 1|cut -c35-56|tr -d ": ." > FDATA
echo "Enter prefix?"
   read PREFIX
FDATA=`cat FDATA|cut -c1-8`
   FHORA=`cat FDATA|cut -c9-10`
   FMIN=`cat FDATA|cut -c11-12`
   FSEG=`cat FDATA|cut -c13-14`
   FDECS=`cat FDATA|cut -c15-16`
#Rename files. This may look obsessive, but remember cameras may shoot in 'sequential' #mode, and produce files with the same Hour-min-secs data, that's why the deciseconds.
   mv $arg "$PREFIX"_"$FDATA"_"$FHORA""$FMIN""$FSEG""$FDECS".NEF

done


you can also choose to remove the exif file created. I save all of them, because converting raw's to tiff or jpg will erase lots of fields of exif data. I like to keep it.

Now you have files with the date on the name. Another script can loop through the filenames and mkdirs with the date on the name, shall not be difficult. I like to keep subdirs to a minimum, so i decided to not split the collection to subdirs, instead develop a system of naming that would group large collections on a single dir easily browseable. Also, it is easier to run scripts on it.


" I would like to download photos off of my digital camera in such a way
that they are sorted into directories by date.  So a photo taken on
Feb 23,2006 would be put in a directory 2006/02/23/filename.  "


So, for example:

bruno@frank:~/foto$ exiftool test.png
ExifTool Version Number         : 6.19
File Name                       : test.png
File Size                       : 26 kB
File Modification Date/Time     : 2005:12:06 22:19:38
File Type                       : PNG
MIME Type                       : image/png
Image Width                     : 292
Image Height                    : 690
Bit Depth                       : 8
Color Type                      : Palette
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Palette : (Binary data 768 bytes, use -b option to extract)
Pixels Per Unit X               : 5906
Pixels Per Unit Y               : 5906
Pixel Units                     : Meters
Modify Date                     : 2003:02:22 22:15:50
Author                          :
Description                     :
Copyright                       :
Creation Time                   :
Software                        :
Disclaimer                      :
PNG Warning                     :
Source                          :
Comment                         :
Title                           :
Image Size                      : 292x690


notice there are two date infos. Figure which one is the adequate for you.

Make year dir:
(might be good to test if it already exists? :))

mkdir `exiftool test.png|grep Modification|cut -c35-38`

Make month dir:
(might be good to test if it already exists? :))

mkdir `exiftool test.png|grep Modification|cut -c40-41`

Make day dir:
(might be good to test if it already exists? :))

mkdir `exiftool test.png|grep Modification|cut -c43-44`

this will work ok, as long as the camera is always the same. Grepping and cutting this way may not work, if the exif change.

exiftool can also WRITE info to exif headers, which is where it starts to get really funny. You can tags your images with comments, your email, etc. After that, you can feed it back to an exiftool filtering script and re-organize them. Possibilities are endless. If you plan to use pictures on a website, tagging exif info might be a way to track clueless people using your pictures inadvertently.

Hope this is of some help.

Sure there are gui tools. But scripting is fun.



Reply to: