Under some circumstances, it's necessary to move photos from one file
system structure to another. In my case, I moved my old photos from my
notebook hdd to a 2TB external device. With this, I also want to start
with a clean database for my new photos.
In my example, I moved the photos from /home/chris/Photosto
/media/EXTERNAL/Photos2011/Photos.
Have a look at my last blog
post .
Within the Photosdirectory I have several sub folders, each representing
one film roll. So, /home/chrisis the base directory of my Photo
directory.
Assuming, you have moved your photos as well as the database and config
files to /media/EXTERNAL/Photos2011, you now have to adjust the paths to
your film rolls in library.db.
Lets have a look into library.db: (make sure, darktable is currently
not running)
$ cd /media/EXTERNAL/Photos2011/.config/darktable
$ sqlite3 library.db
sqlite> .schema film_rolls
CREATE TABLE film_rolls (id integer primary key, datetime_accessed char(20), folder varchar(1024));
sqlite> select * from film_rolls;
1|2011:09:08 11:16:16|/home/chris/Photos/20110904_XXX
2|2011:09:08 11:17:46|/home/chris/Photos/20110908_YYY
[...]
As you can see, the table film_rollscontains an id, the last access time
and the folder - which is the base directory of this film roll. If you
want to, you also could have a look into the table images. Most
important in it is the foreign key film_id, which refers to the film
roll of the specific photo.
However, you just have to adjust the paths of the film rolls and leave
the literal photos untouched.
The change in the database should result in something like:
$ sqlite3 library.db
sqlite> select * from film_rolls;
1|2011:09:08 11:16:16|/media/EXTERNAL/Photos2011/Photos/20110904_XXX
2|2011:09:08 11:17:46|/media/EXTERNAL/Photos2011/Photos/20110908_YYY
I just wrote a few lines of python to do
this move_darktable_photos.py
. This small script runs on python >= 2.6, build with sqlite3 support.
Just call it:
$ ./move_darktable_photos.py \
--library /media/EXTERNAL/Photos2011/.config/darktable/library.db \
-o /home/chris \
-n /media/EXTERNAL/Photos2011