ExifTool Forum

ExifTool => Newbies => Topic started by: andy95 on December 04, 2014, 07:24:06 AM

Title: Rename / Delete | Title from metadata (PDF files)
Post by: andy95 on December 04, 2014, 07:24:06 AM
Hello,

I hope for a little help.

If I make this: exiftool -ext pdf "-filename>title" -r <directory>\
ExifTool write the filename to PDF -> title - OK, Very nice!

But all title with the extension (filename.pdf). How can I delete the extension .pdf in title (name)?

Thanks.
Title: Re: Rename / Delete | Title from metadata (PDF files)
Post by: Phil Harvey on December 04, 2014, 10:32:35 AM
There are a few different ways.  The sample config file (http://www.exiftool.org/config.html) has a BaseName tag which does exactly this.  So you could use this config file and copy BaseName instead of FileName.  Alternatively you could use an advanced formatting expression to remove the extension:

exiftool -ext pdf "-title<${filename;s/\.[^.]*$//}" -r DIR

(the above quoting is for WIndows.  Use single quotes instead on Mac/Linux)

- Phil
Title: Re: Rename / Delete | Title from metadata (PDF files)
Post by: andy95 on December 04, 2014, 11:45:04 AM
Phil big thanks for your help!

Yes this is it what I search but the original file "DATE" are lost if I make it.

This is not good because all files have the same date and year.

Have you a last idea for this problem for me?

Thanks's again.
Title: Re: Rename / Delete | Title from metadata (PDF files)
Post by: andy95 on December 04, 2014, 12:51:10 PM
Ok, I found it ...

exiftool -ext pdf -overwrite_original "-title<${filename;s/\.[^.]*$//}" "-filemodifydate-=1" -r DIR

Title: Re: Rename / Delete | Title from metadata (PDF files)
Post by: Hayo Baan on December 04, 2014, 04:11:32 PM
Andy, it looks like you want to maintain the original file modification time, yes?
Use the -P command line option for this, this preserves the modification time (your way subtracted 1 day from it).

Hope this helps,
Hayo