Monthly Archive for July, 2008

Find (new) images that does not exist in the f-spot database.

Here is a small script which will give some ideas of how it can be done:

 
# Backup your f-spot db-file to /tmp/
cp ~/.gnome2/f-spot/photos.db /tmp/
 
# Run a sql to find the photos matching my photo uri+2008, and 'DSC*.jpg'.
# split the list that sqlite3 generates. I just want the photo name, so that's my 10'th field.
# Uppercase every filename and sort it, then put it into a file.
sqlite3 ~/.gnome2/f-spot/photos.db 'select uri from photos where uri like "file:///home/%/Photos/2008/%DSC%.jpg"' | cut -d/ -f10 | tr 'a-z' 'A-Z' | sort > /tmp/gotFromFspot.list
 
# Go to the directory where you have your camera files. (ps: You should not have photos from 2008 in this directory.
cd /media/PHONE CARD/DCIM/100MSDCF/
 
# find all files and put them into another list.. 'CardFileList.list'
ls -1 | sort > /tmp/CardFileList.list
# Diff the file lists. We only care about the ones that does not exist in gotFromFspot.
diff /tmp/gotFromFspot.list /tmp/CardFileList.list | grep ">" | sed s/> //gi >/tmp/ResultList.list
 
mkdir /tmp/NewImagesTmpDestination
# Loop every file and copy the new, not existing in the f-spot photo db to /tmp/d/
for tmpvariable in `cat /tmp/ResultList.list'; do  cp $tmpvariable /tmp/NewImagesTmpDestination ; done

If you’re new here, you may want to subscribe to my RSS feed.
Thanks for visiting!