[Originally posted by mtpaper on 2008-09-22 11:29:52-07]
Hi -
I've known about the wonders of ExifTool for a couple of years, but was too intimidated to try it from the command line.
I'm ready to learn.
I need to know the syntax both PC and Mac.
I have data, which can be in a tab-delimited file, or an excel sheet.
Many records; first field of each record is unique filename.
I have many files (pdfs).
I need to transfer data from log file to the pdf metadata (title, subject, keywords, created date)
I know it's simple, but I don't understand the syntax. Can you please direct me to a sample command line, that relates to this process? If I get a shove in the right direction, I should be off and running.
Thank you!
[Originally posted by exiftool on 2008-09-22 12:13:09-07]ExifTool doesn't parse tab-delimited files. There are various
ways to handle this, and some may be easier than others
depending on the format of the tab-delimited file:
1) Use a word processor or Excel to change the lines of the
file into command lines for exiftool. ie) lines like this:
exiftool FILE.pdf -title="a title" -subject="a subject" ...
2) Write a simple perl script to parse the tab-delimited file
and call the Image::ExifTool module to do all the hard stuff.
See
this
thread for an example script that does exactly this.
- Phil
[Originally posted by mtpaper on 2008-09-22 12:19:08-07]
Hi Phil -
Thanks for the quick response
I'm comfortable wrangling data within Excel, to get the syntax right.
But I needed the sample (which you provided above) to get me started.
I'll take a look at the linked thread and be back with questions or results -
Thank you -
Marion
[Originally posted by mtpaper on 2008-09-22 12:53:03-07]
.... The command line you wrote in your initial response was easy for me to follow; I find the script intimidating, and need a bit of assistance to get started. Also, I'm new to the mac....
1. I think the first step is to add a column in Excel, which strings the preceeding columns together, so I end up with:
exiftool FILENAME.pdf -title="a title" -subject="a subject"
Once I have that done for all the records, do I copy the newly created concatenated column of text to a text file, such was with TextEditor.app? and save it was a .txt extension?
2. Do I copy the sample script into an Applescript window, or do I need to access Terminal.app?
3. Reading the script, I'm confused since you wrote that ExifTool doesn't parse tab-delimited files, but the script appears to be splitting up the values under the assumption that the lines are tab delimited.....
.... I think I'll have additional questions, but I need the answer to #2 before I can proceed -
Thanks Phil
Marion
[Originally posted by exiftool on 2008-09-22 15:11:18-07]Hi Phil,
You should be able to export from Excel directly to a text file.
Then from a Terminal window, you can execute the text file
(let's call it "commands.txt", and assume it is in your "Desktop"
folder) by typing the following:
cd ~/Desktop
cat commands.txt
chmod 755 commands.txt
./commands.txt
For convienience,
I changed to the .txt file directory before I started (with the "cd" command),
but this isn't necessary, and just saves typing (ie. you can type "commands.txt"
instead of "~/Desktop/commands.txt" in the following commands).
The "cat" command simply lists the .txt file in the Terminal window
so you can see if it looks OK. This command is not necessary.
The "chmod" command makes the .txt file executable.
Then the last command executes the "command.txt" file as a script.
I hope this gets you started. I suggest that you try this out on a set
of test images first. If things don't work as planned, adding the -v
option to each exiftool command line may give some useful information.
What I meant was that exiftool doesn't have the built-in ability to
parse tab-delimited files, so you have to write the script to do this
yourself (as with the small Perl script in example 2) or convert
the tab-delimited file to a series of commands that exiftool can
understand.
- Phil
[Originally posted by exiftool on 2008-09-22 15:16:54-07]
Sorry. After re-reading your last post it seems I may have mislead
you a bit. You can choose either method 1 (create a series of
exiftool commands in a .txt file) or method 2 (create a script to
parse the tab-delimited file directly).
It sounds like we are going with option 1, so the Perl script
won't be used. I hope this is clear.
- Phil
[Originally posted by mtpaper on 2008-09-22 15:41:43-07]
LOL! I see. I misunderstood. I thought I had to make the command line AND write the perl script. OK - I'll definitely go via option 1, and try my hand with the command line. I'll be back in touch.
[Originally posted by exiftool on 2008-09-22 15:58:42-07]
And sorry for calling you "Phil". LOL. I misunderstood when I saw "Phil Marion"
at the end of one of your posts.
[Originally posted by mtpaper on 2008-09-22 16:14:39-07]
Hi Phil - I don't mind being called Phil - I'm thrilled to have the 'hand-holding' for this project, and I don't know why I've been so afraid of EXIFTool Command line operations all these years. OK - I have it working so that I can xfer Subject,Author,Title and Keywords, but I'm confused about Creation Date. I'm looking at your online help about PDF Info Tags, but I'm unclear whether I should be using TAG ID or TAG NAME (it's the only field on your little info table that is different in the Tag ID column and the Tag Name column.) - Thanks Marion
[Originally posted by exiftool on 2008-09-22 16:20:58-07]Hi Marion,
LOL. Phil is good for me.

ExifTool understands the tag names. The tagID is the internal representation
in the PDF document. This becomes more clear when you look at things like
EXIF tags, which have a numerical internal representation.
- Phil
[Originally posted by mtpaper on 2008-09-22 16:48:38-07]
OK about the date - I'll use TAG NAME (not TAG ID). Next - I would like to take it to the next level, by working with it from within the directory where my files are, rather than dragging them to the desktop. But I'm real new with Mac, and don't understand the folder structure nomenclature.
I have it working with: cd ~/Desktop
but I'd like it to be: cd ~/users/marion/documents/pdftesting
But, when I try that from a Terminal Window, I get an error. What is the syntax? I guess the problem is I don't know the root on a mac (I'm more familiar with path nomenclature from PC, but I need to do this on the mac)
Thank you - Marion (who just figured out how to use the html code to make this more readable)
[Originally posted by mtpaper on 2008-09-22 17:04:42-07]
I figured out the path nomenclature too
[Originally posted by mtpaper on 2008-09-22 17:16:56-07]
..... any suggestion as to what I might have done, so that after the CAT FILENAME.TXT line is issued at the terminal prompt, instead of seeing all 3 lines of my test run file, I only see the 3rd line?
[Originally posted by mtpaper on 2008-09-22 19:20:12-07]
Weird... sometimes I get the 3 lines and sometimes just the 3rd. Seems to work better when I create a new text file, rather than pasting on top of the old.
Now I'm working on the time... I have to find the parameters for shifting by 5 hours. I'll let you know if I can't figure it out.
This is great - time consuming to get everything just right, but really great.
[Originally posted by exiftool on 2008-09-23 11:16:12-07]
For instance, you would use "-datetimeoriginal+=5" to shift DateTimeOriginal
by +5 hours.
(it's all really quite easy -- the hardest part is finding what you want in the
documentation -- take a look at the EXAMPLES section)
- Phil