passing filename to piped command | md5sum

Started by luusac, April 23, 2023, 02:43:17 PM

Previous topic - Next topic

luusac

#15
Is there a way of getting exiftool to append output with -w instead of overwriting?

Your link helped, I had read that earlier, but missed -W+ (append).

exiftool -ext jpg -r -p "${ImageDataMD5}  ${Filename}" -w+ %dHashes.md5 .
will give you a "Hashes.md5" per directory, containing MD5 hashes of just the files in that directory (filename only, no path).  If you want the full path in the hashes file you will have to play about with the -p block or a shell script I guess.  I wasn't able to find a list of Exiftool variables (probably looking in the wrong place!) and my guesses of $FullPath didn't work, but

exiftool -ext jpg -p "${ImageDataMD5}  ${Directory}/${Filename}" >> "C:\PathtoHashFileLocation\Hashes.MD5" -r .
Makes one file containing the hashes and relative path to the image files.  :)

Note to myself as much as anybody else:  If you verify the hash in the usual way it will fail because then you will be comparing the image data only hash with the image file hash (the latter will have also included the metadata when generating the hash).  When verifying, use exiftool to regenerate the imagedatamd5 hash and compare that with the stored hash in the .md5 file.

Phil Harvey

Quote from: luusac on May 19, 2023, 05:52:06 AMI wasn't able to find a list of Exiftool variables (probably looking in the wrong place!)

I think you mean tag names?  The tag name documentation is here.  But specifically I think you are interested in the Extra tags.

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

luusac

In what I am trying to achieve at the moment I was more meaning things like FileName, Directory, Path, BasePath etc, things that aren't necessarily part of the metadata, that I could use -p to 'access', like -p "${Directory}/${Filename}". So yes, I think the Extra Tags describes what I was trying to get at:

QuoteThe extra tags provide extra features or extra information extracted or generated by ExifTool that is not directly associated with another tag group.

Many thanks, Phil & StarGeek.