Re: Remove files not in database (identifying files not known to f-spot)



I've used a rather crude, quick and dirty script to sort this. The process won't win any prizes in a beauty contest but it's done the job.

First step is to get a list of filenames known to f-spot. I did this by doing a Select-All then Copy.  (Ctrl-A ; Ctrl-C).

Next I opened a GVIM window. I'm not sure whether the editor is important but I couldn't get this to work in straight vi.
e.g: gvim fspotflist
Go into Insert mode, then press the middle mouse button. (I found using the menu route of Edit / Paste didn't do anything). Save and Exit.

This leaves you with a file containing all the filenames on one line. My database has 30,000 jpegs and it worked ok.

Next a used a bit of shell script to get all the filenames onto one line and then check each file in my photo directory against f-spot's list. The code fragment I used is below. It gave me a list of about 2000 files that I need to investigate. I'm moving them somewhere else and intend to check through them and re-import them accordingly.

A couple of surprises was the number of jpegs hiding in .thumbs directories. Not sure whether it's geeqie or gthumb that leaves this detrius around.

Dougie
#!/bin/bash


INFILE=/home/dougie/fspotflist
OUTFILE=/home/dougie/fspotorphans
PHOTOS=/jpegs

> ${OUTFILE}

# create fspot flist one per line.
# assume can sub SPACE SLASH with NL SLASH
cat ${INFILE} | sed 's/ \//\n\//g' | while read fname
do
      echo "${fname}"
done > ${INFILE}_1fnameperline

find ${PHOTOS} -iname '*.jpg' | while read fname
do
      if ! grep -q "${fname}" ${INFILE}_1fnameperline
      then
            echo "ORPHANED: ${fname}"
            echo "${fname}" >> ${OUTFILE}
      fi
done



On 17/09/2010 22:46, Dougie Nisbet wrote:
 I've just had an accident with f-spot ( https://bugzilla.gnome.org/show_bug.cgi?id=629963 ) and got round it by removing about 1000 images from the catalogue. I suspect that I now have a lot of images on disk that don't exist in the catalogue. The details are unimportant suffice to say I'd be very interested in tidying up my /jpegs tree and removing any files that are not known to f-spot.

Some time ago (Oct 2009) there was discussion of orphaned files and a script uploaded (http://paste.ubuntu.com/292946/) that looks promising. I've been reviewing the thread and I'm not certain whether it works with 0.8.0 and whether it has a -dry-run type option (aha - I see 'demomode'). I'm a bit scared to run it even though everything's backed up. Am I right in thinking that it will physically remove files from the disk that are not known in f-spot's catalog?

Thanks,

Dougie

_______________________________________________
f-spot-list mailing list
f-spot-list gnome org
http://mail.gnome.org/mailman/listinfo/f-spot-list




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