[KPhotoAlbum] Multiple versions of an image

Aleksi Halkola halkola at gmail.com
Thu Dec 9 22:23:34 GMT 2010

Hello Andreas,

thanks for your reply. It gave me lots of new ideas :). One that works 
with sed is:
echo dsc_8084.jpg    | sed 's/\(........\).*/\1.nef/g' -> dsc_8084.nef
echo dsc_8084_v2.jpg | sed 's/\(........\).*/\1.nef/g' -> dsc_8084.nef
echo dsc_8084_v2.nef | sed 's/\(........\).*/\1.nef/g' -> dsc_8084.nef

"File versions search regexp:"
"Original file replacement text:"

This doesn't group the photos in kphotoalbum for some reason. My ideas 
was that since most of my photos (and all from digital cameras?) have 
8.3 letter file names the (........) matches the base of the name so 
that I can reconstruct the original with \1.nef and the .* just removes 
the rest of the versioned file name (either .jpg or _v?.jpg).

Anyways, the solution I found yesterday works for most cases so I'm not 
too bothered.



08.12.2010 23:59, Andreas Neustifter kirjoitti:
> Hi Aleksi!
> On 8 December 2010 23:09, Aleksi Halkola<halkola at gmail.com>  wrote:
>> I found a solution that I think will work pretty well for me. I took
>> inspiration from http://www.hardakers.net/kphotoalbum/#sec-4.2,
>> I used the following settings:
>> "File versions search regexp:"
>> (.*)_v[0-9]*\.(.*)
>> "Original file replacement text:"
>> \1.nef
>> [...]
>> I learned
>> regular expressions only this evening so if anybody knows how I can catch
>> both dsc_8237.jpg dsc_8237_v2.jpg as versions of dsc_8237.nef I'd be very
>> happy.
> Those regular expression do not need to match the whole file, mine for
> example are "_v[0-9]*\." and "." (a single dot). This way one can
> insert a version between the file name and the extension and this file
> is then recognised as new version of an old file.
> (This is a little fiddly, it assumes that the filename has only one
> dot in it, which is the case with my files.)
> I was not aware of the regular expression supporting named groups, so
> in this case maybe "(.*)_v[0-9]*\.(.*)" and "\1.\2" would work? (The
> two "(.*)" each form a group of characters that can be accessed in the
> second expression as \1 and \2. At least it seems that this is
> possible from your example.)
> Hope that helps,
> Andi
> _______________________________________________
> KPhotoAlbum mailing list
> KPhotoAlbum at mail.kdab.com
> http://mail.kdab.com/mailman/listinfo/kphotoalbum

More information about the Kphotoalbum mailing list