Relocating your existing F-Spot photo store (e.g. ~/Photos to ~/Pictures)

This howto allows you to move your entire photo store to a different location, and instruct F-Spot to use this new path without re-importing photos and risking data loss:


1. Move the photo store where you want it to be (if you haven’t done so already!)

2. Back-up your F-Spot database

cp ~/.gnome2/f-spot/photos.db ~/.gnome2/f-spot/photos-backup.db

3. Install and start sqlite

sudo apt-get install sqlite3
sqlite3 ~/.gnome2/f-spot/photos.db

5. Perform an update command against the “photos” table. Make sure you set the paths to match your own

update photos set directory_path = '/NEW/PATH' || substr(directory_path,length('/OLD/PATH/'),length(directory_path)) where directory_path like '/OLD/PATH/%';


update photos set directory_path = '/home/sean/Pictures/photos' || substr(directory_path,length('/home/sean/Photos/'),length(directory_path)) where directory_path like '/home/sean/Photos/%';

6. Quit sqlite


From here on, assuming these steps worked, you should be able to start F-Spot and all your photos are still found!

If something went wrong, you can revert to the old database by moving the photos back where they were, and running this command:

mv ~/.gnome2/f-spot/photos-backup.db ~/.gnome2/f-spot/photos.db

NOTE: F-Spot appears to rebuild it’s thumbnail cache when you start it the first time after doing this, you will notice that all the photos have no images. Leave it for a few minutes and you should find all the photos will eventually flood back into existence.

Thanks to and for pointers.


9 Responses to Relocating your existing F-Spot photo store (e.g. ~/Photos to ~/Pictures)

  1. Tom says:

    There’s an much more easy command:

    update photos set uri = replace(uri,’/home/tom/Fotos/’,’/home/tom/Bilder/Fotos/’);

  2. Berend says:

    This did the trick for me:

    update photos set uri = replace(uri,’/home/berend/dsc’,’/home/berend/Photos/dsc’);

  3. Craig Loftus says:

    You method didn’t actually work for me… I got this error:

    SQL error: no such column: directory_path

    I suppose it has now change to be ‘uri’.

    Using the command suggested in the comments does work, although you have to be careful when copying and pasting from the commands given above. The quotes around the strings are not correct.

    To add yet another example of “what worked for me”:
    update photos set uri = replace(uri,'/home/craig/Photos','/home/craig/media/photos');

  4. […] this is probably the manual which gives the best guidance but I will see […]

  5. malte says:

    F-Spot now ships with an extension called ChangePath. As far as I understand it does the same job as what is described above.

  6. Using F-Spot (Ubuntu 8.04 LTS package version, I had to apply a corresponding update to the photo_versions table for all versions of all photos to be affected by the change. Posting here in case anyone else finds themselves in the same situation. (As far as I can tell, ChangePath is not available for this now-near-ancient version.)

  7. Timo says:

    At least since F-Spot the column which contains the path is called “base_uri”. And, like Michael mentioned, the two similar updates on “photos” and “photo_versions” did the work.

  8. Mike says:

    In agreement with Michael Kjorling and Timo, this update needs to be performed on both the photos and photo_versions tables, and the column is now named base_uri.

    When we start to need to do double updates in cases like this, doesn’t that usually signify the need for another table and mapping?

  9. Joël says:

    Hi All, I just did the same move on my new computer, as I wanted the pictures to be in another place. I confirm that command has to be executed twice, on tables named photos and photo_versions, on field base_uri. This is for F-Spot version 0.8.2, on Ubuntu 11.10.

    I’m coming to the main interest of my post: the time of execution. On my Core2Duo laptop, it seems to have taken less than 2s to complete; now all thumbnails are being created (which takes much more time!).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: