/PHOTOS/Photos/2006.06.30/
/PHOTOS/Photos/2006.07.01/
But sometimes I've forgotten to unclick the "Copy file to the Photos folder" box in the photos import dialog and end up with photos under ~/Photos/. Recently I checked and found there were almost a gigabytes worth of photos under there.
So this is what I did to move them to under /PHOTOS/Photos/ and keep all the tags and metadata correct.
- Back up /home and /PHOTOS to an external USB. I love rsnapshot.
$ rsnapshot daily
- make an extra backup of the f-spot database
$ cp ~/.gnome2/f-spot/photos.db photos-backup.db
- Start poking around the f-spot database and updating it.
$ sqlite3 ~/.gnome2/f-spot/photos.db
sqlite> .schema photos
CREATE TABLE photos ( id INTEGER PRIMARY KEY NOT NULL,
time INTEGER NOT NULL,
directory_path STRING NOT NULL,
name STRING NOT NULL,
description TEXT NOT NULL,
default_version_id INTEGER NOT NULL
); - See how many photos are in ~/Photos...
sqlite> select count(*) from photos where directory_path like '/home/marc/Photos/%';
260 - Take a look at a few of them to see the path names...
sqlite> select directory_path from photos where directory_path like '/home/marc/Photos/%' limit 0,10;
- Update the pathname to my prefered one. I've added an 'a' to the end just so I won't overwrite an existing directory.
sqlite> update photos set directory_path = "/PHOTOS/Photos/2006.06.22a" where directory_path = "/home/marc/Photos/2006/6/22";
sqlite> .quit - Make the directory and move the files to the new location...
mkdir /PHOTOS/Photos/2006.06.22a
mv -v /home/marc/Photos/2006/6/22/HPIM117* /PHOTOS/Photos/2006.06.22a
Repeat for each directory. I did it all within emacs' shell so cut-n-paste made it a snap.
Why not just create a symbolic link from ~/Photos to wherever you want them to go?
ReplyDeleteBecause I don't know what would happen new photos are added.
ReplyDeleteNow that they are 'normalized', I suppose I should hack the db so they are all under ~/Photos and see what happens (after the next full backup ;-)
Thanks for the post. I use F-Spot myself and found that the photos were taking up too much room in my home directory, so I moved them all to another partition. Naturally F-Spot didn't update the photos database.
ReplyDeleteRather than run through the SQLite command-line tool, I ended up creating a Perl script; it was easy to write, and it's actually readable, since there's only one regexp line.
[...] “Moving photos around behind f-spot’s back” has been really helpful for the first steps, but he used copy-pasting. I simply did UPDATE photos SET directory_path = (SELECT ‘/home/tomcat/Media’ || SUBSTR(directory_path,13,100) FROM photos AS a WHERE a.name = photos.name); [...]
ReplyDeleteI ended up using a method suggested at this site
ReplyDeletehttp://ubuntuforums.org/archive/index.php/t-254674.html
Dump the db into a text file where you can find/replace the paths, then dump it back! nice :)
sqlite3 ~/.gnome2/f-spot/photos.db .dump > f-spot.dump
mv ~/.gnome2/f-spot/photos.db photos.db.backup
sqlite3 ~/.gnome2/f-spot/photos.db
[...] where this Marc Novell post comes in handy. The post is a few years old, so the steps are slightly different, but the concept [...]
ReplyDelete