Re: Moving disk files by export/import?



On Sat, Jan 03, 2009 at 03:43:04PM -0500, Dave Sill wrote:
> I'm a newbie so bear with me. I normally store my photos under
> /data/photos. The first couple of rolls I imported to my home
> directory, so I've got 2007, 2008, etc. directories--I'd assumed it
> would create a Photos subdir, but obviously not. Anyway, I've changed
> my import directory to /data/photos, but I'd like to get the 300+
> photos in my home directory moved there, too, but I don't want to have
> to retag them.
> 
> I search the list archives and found a PHP script that I can probably
> modify to do the job, but I'm not crazy about mucking around with the
> database.

I think mucking would be easier than exporting and importing.

This is completely untested, but it's easy enough to play with.
I have f-spot 0.5.0.3.

Move your photos to the photos directory, something like:

    $ mv 200* /data/photos/

Make a copy of your database (this is where mine is):

    $ cp  .gnome2/f-spot/photos.db test.db

    $ sqlite3 test.db
    SQLite version 3.5.9

Then muck all you want.


I'm only renaming one (where id = 1).  You can use a more complex
where to select which to operate on, or just leave it off to do it
with all:

    sqlite> select uri from photos where id = 1;
    file:///media/store/photos/2004/05/06/foo.jpg

Do the replace (you would want to make sure you have a good match
string):

    sqlite> update photos set uri = replace( uri, '2004', 'photos/2004' ) where id = 1;


    sqlite> select uri from photos where id = 1;
    file:///media/store/photos/photos/2004/05/06/foo.jpg

Now, there's also a "photo_versions" table, so you would likely need
to repeat for the "url" there, too.


-- 
Bill Moseley
moseley hank org
Sent from my iMutt



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