Share your favorite scripts

This little one is extremely useful to my photographic workflow:

IFS="$(echo -e "\n\r")"
for EACHFILE in `ls -1 | grep -v md5sum.txt | grep -v ".xmp$"`
do
    if ! egrep -q  " $EACHFILE$" md5sum.txt; then
    md5sum $EACHFILE
    fi
done

(I do not claim authorship since this is copy-paste of several sources and fiddling a bit with the result, and no master stroke of me.)

I named it md5new and it is usually called like that:

md5new | tee -a md5sum.txt

Called in a folder with images, it updates the checksums of recently imported raw and jpeg files. Since sidecars (xmp in my case, since I use darktable) are living in a git repository, they are ignored by the script.

What is still missing is an automated way to crawl my entire photo library and check all the photos and find these that were not added to a checksum file. Unfortunately, fiddling with find needs hours of try and error to get all the space and special character handling correct. And I am still not sure if it would be the most reasonable approach. Therefore, from time to time I check some random samples of my photo library instead.

An even better way would be sidecars containing the checksums, but if this is already implemented somewhere, I missed it. I guess, the dng format offers the possibility to have checksums in the raw, but I shoot canon and sony. If I were sure that darktable would handle “stub” sidecars containing only the checksum (as a correct xmp xml entry), I would try that approach. But I don’t want to ask for support, since the dt community already got too many of my workflow improvement feature requests :blush:.

1 Like