News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Basename tag and multible punctuations

Started by mads, May 29, 2013, 03:09:39 PM

Previous topic - Next topic

mads

Hi there,

First of all thank you for a great tool, it is exactly what I need for processing my incoming photos.

Now for the question.. I got several weirdly named files I wanna process by settings various tags, one of them being the original filename without extension.

I saw a post mentioning a BaseName tag accessible when using the sample config file. It seems to work fine, but I have a small issue with filenames that contains more than one punctuation.

ex: "2013-05-21 11.28.30.jpg".

With these files BaseName simply returns "2013-05-21 11" instead of "2013-05-21 11.28.30"

Can I easily change something in the sample config file to prevent this?

/Mads

Phil Harvey

#1
Hi Mads,

The current version of the sample config file should handle this properly:

> exiftool "2013-05-21 11.28.30.jpg" -basename
Base Name                       : 2013-05-21 11.28.30


this is the relevant ValueConv for the BaseName tag in the current config file:

            # remove the extension from FileName
            ValueConv => '$val[0] =~ /(.*)\./ ? $1 : $val[0]',


- Phil

Edit: I checked the revision history and this part of the sample config file hasn't changed since Feb. 2007, version 6.78.  Versions earlier than this exhibit the behaviour you describe.  Are you really using a 6-year-old config file?
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mads

hmm, well... what can I say... I just copy/pasted the config file from here:

http://www.exiftool.org/config.html

It contains :

# remove the extension from FileName
            ValueConv => 'my $name=$val[0]; $name=~s/\..*?$//; $name',


I'll try with your snippet or even better, find the download link to the proper current config file  ;)

Thanks for sorting this out for me so quickly!

/Mads

mads

Found it. The distribution pack... Right there on the frontpage.. DUH!

Never got around to download that as I started off with only the windows executable and everything seemed fine ;)

/Mads

Phil Harvey

#4
Quote from: mads on May 29, 2013, 06:37:23 PM
hmm, well... what can I say... I just copy/pasted the config file from here:

http://www.exiftool.org/config.html

Oops.  That explains it.  Thanks for pointing this out.  I've updated the web page to fix this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).