0

I'm trying to automatically rename all my photos using “exiftool”, which would be very easy, if it were not because I want to do it using a special monitored directory as input to it, thanks to “entr”.

The idea is that when a modification in the "input" directory is detected by “entr”, it calls “exiftool” who renames all photos in this directory. Something like:

#!/bin/sh
while true; do
    echo /input | entr -d exiftool -d '%Y-%m-%d %H.%M.%S' '-FileName<${CreateDate}.${FileTypeExtension}' /input
done

When I copy 5 photos or less, all is working as expected. But... Problems arise when coping several photos at once to the "input" directory... Maybe a race condition is happening? Like “entr” is calling several times to “exiftool” to rename several times the same photos?

So, I have thought about putting a condition to “entr” to only call “exiftool” if it's not already running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.