Hello
my filenames look like this
c:/Folder1/.../FolderX/2003/2003-12 Eventname/2003-12-10_07-50-02_Canon EOS 300D DIGITAL_103_0358_JFR.JPG
I use RegEx to extract "parent folder of the file" + the fixed string Event/ as Prefix
'-subject<Event/${filename;(\d{4}-\d{2} [^\/]*)}'
result: Event/2003-12-10_07-50-02_Canon EOS 300D
expected result: Event/2003-12 Eventname
Where is the issue?
According to https://regexr.com the expression is "valid" and extracts the right part ...
ExifTool raises a ...
Warning: Search pattern not terminated for 'filename'
Many thanks in advance for tipps
Hi Chris,
The exiftool advanced formatting expression is a perl expression, not a regular expression. Try this:
'-subject<Event/${filename;$_ = /(\d{4}-\d{2} [^\/]*)/ ? $1 : undef}'
- Phil
many thanks for the fast response;
now:no warning :-)
But still the same wrong result; there is still an issue with perl expression
Result: Event/2003-12-10_07-50-02_Canon EOS 300D
Expected: Event/2003-12 Eventname
everything seems for me OK ... why this result (hope there is no copy paste issue on my side)
upps. my issue: Filename contains only filename + file extension!
I try now again with "Directory" instead of Filename
@all: now I found the right thing (using search now with right keywords) here
https://exiftool.org/forum/index.php/topic,8714.msg44724.html#msg44724
The solution is
${directory;s/.*\/([^\/]*$)/$1/}
@Phil: Many thanks for your quick response and for this great piece of software!
Great, glad you figured it out.
There is definitely more than one way to do it. The main difference between the technique you found (using a substitution expression) and my example is that if the expression doesn't match your technique will set the Subject from the full directory name, while the technique I showed won't write anything.
- Phil