Migrating the image repository



Hi all.

I was using an external hard-disk to store my photos, so they were all
under /media/big/Photos/... 

After a move to a new computer with a much more capacious internal
drive, I thought I'd move them to ~/Photos (i.e. into my home
directory).

I didn't want to re-import them in case I lost tagging data (These days,
I do have the option to write tags to files set, but I was using f-spot
for a while before I noticed that option).

For the record, the following technique worked perfectly, although is
not for command-line novices:

Copy the files to their new location. For this I used:
$ cp -a /media/big/Photos ~/Photos

Open the photos.db in sqlite3:
$ sqlite3 ~/.gnome2/f-spot/photos.db

Dump out the contents of the tables "photos" and "photo_versions" (this
creates two new files "photos.sql" and "photo_versions.sql".)
sqlite> .output photos.sql
sqlite> .dump photos
sqlite> .output photo_versions.sql
sqlite> .dump photo_versions

Delete the contents of the tables photos and photo_versions:
sqlite> delete from photos;
sqlite> delete from photo_versions;

Now open photos.sql and photo_versions.sql in your favourite editor (I
used vim) and search/replace the old directory names with the new.
Also, remove the lines starting with "CREATE". Save the files.

Now read the files back into the database:
sqlite> .read photos.sql
sqlite> .read photo_versions.sql

Exit:
sqlite> .exit

When I subsequently ran f-spot, everything was as it should be.

(Aside: an improvement would have been to remove the tables entirely
which would have meant I didn't need to remove the CREATE lines.)

OK, aside from recording the fact that this technique works, I was
wondering if there is an easier way? It seems possible to me that the
image repository will eventually become too big for many users, and they
will want to move it out of their home directory and onto external
storage. (As it happens, that's the opposite of what I wanted, but
anyway...)

Good luck,

Malcolm




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