.fmt file for -p option accessible globally?

Started by Wally, August 11, 2017, 04:17:39 PM

Previous topic - Next topic

Wally

I have written a shell script that uses ExifTool -p with multiple .fmt files. I've figured out how to make my shell script accessible globally (I've placed it in /usr/local/bin -- I'm working in MacOS). Is there a place I can put the .fmt files to ensure the script refers to them no matter where I'm calling the script?

Also - to point ExifTool to the now globally accessible .fmt files (assuming it's possible), do I just need to add the path to the .fmt file? e.g.
"ExifTool -p /correctPath/myFormat.fmt myFile.jpg" ?

Thanks!

Phil Harvey

Yes, just specify the full path in the -p option.  You can put them wherever you want, even in /usr/local/bin if you want.

- Phil
...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 ($).

Wally

Thanks, Phil. Unfortunately I think I've bit off more than I can chew with my limited UNIX experience. (This is the first shell script I've ever written). When I run the script -- on a batch of audio files -- I get a long output of just the names of the different .fmt files. Something tells me I need to setup something having to do with the PATH environment? If it helps, here's the shell script I've written, the idea is to run it inside a folder of audio files and output a JSON doc:

#!/bin/bash

audioFiles=(*.wav)
numberOfFiles=${#audioFiles[@]}
firstFile=${audioFiles[0]}
penultFile=$(( $numberOfFiles-2 ))
lastFile=${audioFiles[$numberOfFiles-1]}

declare -a middleFiles

for i in $(seq 1 $penultFile); do
middleFiles+=(${audioFiles[i]})
done

ExifTool -p /usr/local/bin/SoundManifestHead.fmt ${audioFiles[0]} > sounds.json

for i in $(seq 0 $(( $penultFile-1 ))); do
ExifTool -p /usr/local/bin/oundManifestBody.fmt ${middleFiles[i]} >> sounds.json
done

ExifTool -p /usr/local/bin/SoundManifestEnd.fmt $lastFile >> sounds.json

ExifTool -p /usr/local/bin/SoundSpritesHead.fmt ${audioFiles[0]} >> sounds.json
ms="$(soxi -s ${audioFiles[0]})"
dur=$(bc <<< "$ms/44.1")
echo $dur"},">> sounds.json

for i in $(seq 0 $(( $penultFile-1 ))); do
ExifTool -p /usr/local/bin/SoundSpritesBody.fmt ${middleFiles[i]} >> sounds.json
ms="$(soxi -s ${middleFiles[i]})"
midDur=$(bc <<< "$ms/44.1")
echo $midDur"},">> sounds.json
done

ExifTool -p /usr/local/bin/SoundSpritesBody.fmt $lastFile >> sounds.json
ms="$(soxi -s $lastFile)"
endDur=$(bc <<< "$ms/44.1")
echo $endDur"}">> sounds.json

ExifTool -p /usr/local/bin/SoundSpritesEnd.fmt $lastFile >> sounds.json


EDIT: I should mention that this script works perfectly when the .fmt files are in the same directory as the audio files.

Wally

Nevermind. Classic n00b human error. It helps to update the paths in the version of the script that's in /usr/local/bin!

Works perfectly, thanks!