Adjust the Command for Filenameparts

Started by MKatze, August 20, 2024, 10:00:56 AM

Previous topic - Next topic

MKatze

Hi everyone,

I made a script with help of this forum. Works fine so far but I still didn't get the "Cryptic Code" neighter a Name of it so I can search for it explicit.
So I end up here.

My Code:
exiftool "-title<${filename;s/_-.*//}" "-description<${filename;s/.*?_-//;s/\s[^\s]*$//}" ".\Umzuwandeln\*.jpg"
Real Filenames are like "1234_-12V-12B-12V.jpg"

In my own documentation is an example filename with additional Text "1234_-12V-12B-12V Test.jpg"

In both cases the error is the same: The Title works fine, the description doesn't. It should be Title = Red and Description = Green

"1234_-12V-12B-12V.jpg"

I hope that anyone can help me, I really appreciate all thoughts :-)

Kind

Christian

StarGeek

It helps to tell us exactly what is wrong with the value that ends up in Description, but I'm guessing that the problem is that it is including the extension .jpg.

The original command requires that there is a space in the filename and removes everything after it. But this example doesn't have a space, so nothing is trimmed off the end.

Try using Basename instead of Filename. The Basename tag already has the extension stripped away.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

MKatze

Hey,

thank you for your lightning-fast reply!

I'm Sorry for letting out the failure.  :-X
As you thought the fileending was the thing. It didn't cut off.

The Hint with the Basename didn't work first as my Version (Windows .exe from 2019) told me that the Parameter wasn't filled. I now loaded the most recent Version for Windows and it works like a charm.

Thank you so much!

Kind

Christian

StarGeek

Quote from: MKatze on August 22, 2024, 08:56:28 AMThe Hint with the Basename didn't work first as my Version (Windows .exe from 2019) told me that the Parameter wasn't filled. I now loaded the most recent Version for Windows and it works like a charm.

Yep, Basename was added in ver 12.22 Mar. 17, 2021.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype