Author Topic: help writing windows script for os x  (Read 2224 times)

iwhisperer

  • Newbie
  • *
  • Posts: 3
help writing windows script for os x
« on: November 25, 2011, 11:58:03 AM »
Hi,
My coworker wrote several .bat files for windows to tag rather large batches of images and I need to transfer these to terminal on the Mac.  I made several attempts but results are not coming out the same including a new csv file is placed ~/ vs. the directory I have in the script; ~/Documents/Tag/

Help "translating" the .bat's to the same result on the Mac would be very much appreciated.

.bat's:
1. exiftool.exe -k -csv -caption-abstract -headline -keywords -imagedescription "C:\Documents and Settings\" > out1.csv

Exports meta and overwrites current out1.csv file in same folder as exiftool.exe
I edit the out1.csv with new values, save and close, then the run the next .bat

2. exiftool.exe -k -overwrite_original -csv=out1.csv "C:\Documents and Settings\"
Images get renamed per the three tags in 1.

3. exiftool.exe -k "-FileName<${Keywords}.%%e" "C:\Documents and Settings\"
Not even sure what this one does since I only use the first two but would be nice to know.

Again, thanks for the help!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14405
    • ExifTool Home Page
Re: help writing windows script for os x
« Reply #1 on: November 25, 2011, 12:22:49 PM »
The commands could be:

1. exiftool -csv -caption-abstract -headline -keywords -imagedescription ~/Documents/Tag > ~/out1.csv

2. exiftool -overwrite_original -csv=/Users/$USER/out1.csv ~/Documents/Tag

3. exiftool '-FileName<${Keywords}.%%e' ~/Documents/Tag

The only tricky one is 2.  You can't use "~" in the -csv= argument because the shell doesn't expand it unless it is at the start of the argument.

To make a "batch" file on OS X, put the command in a text file, then run "chmod 755 FILE" to make it executable.  This saves typing the whole command each time.

- Phil

Edit: To make the batch file clickable in OS X, either name it with a ".command" extension, or select "File/Get Info" from the Finder menu and set "Open with" to the Terminal app.
« Last Edit: November 25, 2011, 12:50:40 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

iwhisperer

  • Newbie
  • *
  • Posts: 3
Re: help writing windows script for os x
« Reply #2 on: November 25, 2011, 08:33:40 PM »
Thanks Phil! I'll give it a shot and report back.

iwhisperer

  • Newbie
  • *
  • Posts: 3
Re: help writing windows script for os x
« Reply #3 on: November 27, 2011, 10:59:20 AM »
One tweak to 1 seems to work, and 2 works a treat. FWIW we use these tags in picasa and volusion.

1.
Code: [Select]
exiftool -k -csv -caption-abstract -headline -keywords -imagedescription ~/Documents/Tag > out1.csv
out1.csv created in ~/ listing source file path

Did not use 3 since 2 met my needs. Also, I went ahead and made Automator apps after getting an admin error using .command plus, hey, it's an app ;)

Thanks again!