Changing directory structure inside Shotwell's Photo directory leads to long rescan

Background:
I have my photos stored on an external hdd (~75k file library), setup to watch library directory for new files.
I upgraded to a new laptop, so needed to move the shotwell db.

I copied ~/.config/shotwell ~/.local/shotwell and ~/.cache/shotwell (so I don’t have to recreate thumbnails). This was a little different than the steps on the Shotwell wiki, so not sure if the above leads to issues.

It did seem to work, in my case.

On the new computer, after the migration was successful, I then got the bright idea to change the directory subfolder structure for the photos on the external hdd.

/path/to/photos/year
became
/path/to/photos/foo/year

I expected this to simply lead to a relatively quick “Updating Library” the next time I opened Shotwell, so there are no new photos, and all hashes/thumbnails have already been created.
However, Shotwell seems to be running a pretty intensive complete scan, that is taking many hours to complete.
If I had to guess, the shotwell db is having to rewrite the location for each file?

Is the issue that the photo directory structure can’t be changed once the files have been imported into Shotwell?

I do have some RAW files, in case that affects the above scenario.

You basically pulled the rug from every file in the db, so yes, all files are considered new. I think it can match up the files using the hashes in the DB, but calculating hashes isn’t that cheap for large files.

1 Like

It sounds a couple takeaways from this are: As a rule of thumb, it’s better to clean up the file structure before importing into Shotwell?
And, changing the imported file structure should be avoided, so as to not need to recalculate the file hash?

It’s funny that I was able to smoothly achieve what I thought would be the hard part (moving the db from old to new laptop). But created some unnecessary overhead on what I thought would be the “easy” part (I assumed because Shotwell reads the file structure, and scans for changes, the directory structure change would be superficial).

I’ve been really impressed with how Shotwell handles Missing Photos. I think this lead me to make some incorrect assumptions about how Shotwell would handle the directory change.

Thanks @jensgeorg for your help.

Yes, currently it is easier to change the file structure before import.

I am planning for adding a “data migration wizard” which helps you to move your library around since there are some other implications (the infamous file multiplication for example)