exiftool not copying tags when run from shell script

Started by sirlunk, July 03, 2022, 09:57:35 AM

Previous topic - Next topic

sirlunk

Hello  :)

Running the following command in a terminal window on macos works great:
exiftool -tagsfromfile "/Users/bob/folder/image1.NEF" "/Users/bob/folder/image1.JPG" -overwrite_original

BUT, if I create a exiftoolbatch.command file with the above line replicated many times (one line per NEF/JPG file pair), I get the following message for every file:
Warning: No writable tags set from ...
  0 image files updated
  1 image files unchanged

I'm specifically using the full file path for every file. I've tried using single and double quotes (I don't know which I'm supposed to use in shell scripts, I'm new to macos). The JPG was extracted from the RAW file using exiftool. I've run "chmod u+x exiftoolbatch.command". I'm not invested in using shell scripts, but I've found that pasting multiple commands directly into the terminal window is hit and miss, with some commands being executed, and others not. I'm just looking for the simplest solution (slow is fine!) to reliably (a) extract JPG from RAW and (b) copy the exif tags from the RAW to the JPG file.

Many thanks in advance for your help!

Alan Clifford

Can you make your exiftoolbatch.command file available for us to look at?

StarGeek

It's absolutely impossible for us to tell you what's wrong unless we see what you're doing.  Full exact command and full exact output.

Since you're on Mac, you'll want to use single quotes, especially around any parameter with a dollar sign.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

sirlunk

Thank you for the speedy replies. Sorry, I should have elaborated that the "script" (copyexif.command) is nothing more than a list of commands. One per file. No variables. The file is nothing more than this, only 1000+ lines instead of the two I'm pasting here. There's nothing else in the file.

filename: copyexif.command
exiftool -tagsfromfile '/Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33174.NEF' '/Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33174.JPGfromRAW.X.jpg' -overwrite_original
exiftool -tagsfromfile '/Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33175.NEF' '/Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33175.JPGfromRAW.X.jpg' -overwrite_original

And here's the output when I execute the script (by running: sh copyexif.command):

Warning: No writable tags set from /Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33174.NEF
    0 image files updated
    1 image files unchanged
Warning: No writable tags set from /Users/Redacted/_PHOTO_WORKFLOW_CARNE/_PHOTO_IMPORT/NIKON D800/6003189_33175.NEF
    0 image files updated
    1 image files unchanged

If I copy one line and paste it into the terminal, it works perfectly. I just want to avoid copying and pasting 1000+ times. I know this could get much more clever than what I've done, but I just wanted something quick and easy.

Thank you.


Alan Clifford

One difference I discern from that information is that when you copy and paste into the command line, you will be using bash or zsh rather than sh.  Probably not significant but you should remove the difference before proceeding further with you investigation.

StarGeek

I see nothing wrong with the command, so I'm not sure what's wrong.  But I do see how you can run it as a single command for all your files.

Since the NEFs and the .JPGfromRAW.X.jpg files are in the same directory, you could use this command, assuming there are no other jpgs in the directory.  I would also suggest using -All:All to avoid FAQ #9b
exiftool -overwrite_original -ext jpg -TagsFromFile %d%-.13f.NEF -All:All /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

sirlunk

Thank you StarGeek. That worked perfectly!

While I've had better success extracting jpgs from the raw NEF files, I see that some jpgs are missing - probably due to me pasting hundreds of commands into the terminal and some failing to execute for some reason. Is there a similar single command I can use to extract the jpgs from all of the NEFs in the folder, using the .JPGfromRAW.X.jpg prefix for the jpgs (instead of NEF)? And even better, is there a way to extract the jpgs AND copy the exif metadata in a single command?

I'm grateful for your help. Thank you.

StarGeek

Quote from: sirlunk on July 03, 2022, 01:28:16 PMIs there a similar single command I can use to extract the jpgs from all of the NEFs in the folder, using the .JPGfromRAW.X.jpg prefix for the jpgs (instead of NEF)?

Some like this (I haven't tested it)
exiftool -ext nef -b -jpgfromraw -w %d%f.JPGfromRAW.X.jpg /path/to/files/

QuoteAnd even better, is there a way to extract the jpgs AND copy the exif metadata in a single command?

No, they have to be two separate commands.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).