Appending folder name to author metadata for PDF

Started by Hiryu, January 15, 2016, 11:50:26 AM

Previous topic - Next topic

Hiryu

I tried this in the terminal

echo "${PWD##*/}"

this gives me the exact folder name where the pdf (that I want to process) is residing.

so how would I integrate that and make author as the result of ${PWD##*/}?  That would be exactly what I want.  Please help!  Thanks -- and thank you for all your help thus far.

Phil Harvey

OK, the exact command is:

exiftool '-PDF:Title<${filename;s/\..*?$//}' '-XMP-dc:Title<${filename;s/\..*?$//}' '-author<${directory;s(.*/)()}' /Users/HX/Dropbox/ResearchJournal/Research1/research12.pdf

With the absolute path (starts with a "/"), the working directory doesn't matter, so this command should work from any directory.

- Phil

P.S. I've moved this thread to the Newbies forum because it fits in best there.
...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 ($).

Hiryu

Hey Phil -- I just tried it and nothing appeared in the author metadata tag when I open up the pdf in preview and look at tools -- show inspector (after running the command, of course)


Is there anyway to set author to "${PWD##*/}" (the current directory of the pdf on which the script is being applied to)?