If I want to write keywords on a single file then it works.
exiftool -Keywords='Plex' '/volume1/homes/username/Photos/SORTED/DJI/DJI_AIR_2S/2021/09/09/Plex Versions/Optimized for TV/DJI_AIR_2S__2021-09-09_10.22.14__0009.mp4'
But with multiple files, it doesn't write the keywords. Why doesn't this work?
DIR='/volume1/homes/username/Photos/SORTED'
find $DIR -type f -name '*.mp4' -path '*/Plex Versions/*' ! -path '*/@eaDir/*' > $DIR/temp.txt
exiftool \
-@ $DIR/temp.txt \
-Keywords='Plex' \
'-*Date<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' -wm w \
'-FileModifyDate<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' \
-api QuickTimeUTC \
-overwrite_original \
-progress
exiftool -a -s -G1 -time:all -Keywords -@ $DIR/temp.txt
rm $DIR/temp.txt
In what way doesn't it work? Is an error message thrown?
My guess is that you don't think it works because your Keywords isn't showing up in Plex. But if you take a look at what you actually wrote to the file, you'll see that your command writes to XMP-pdf:Keywords, a PDF tag.
So this is probably FAQ #3 (https://exiftool.org/faq.html#Q3). Find a file that already shows your keywords and run the command in FAQ #3 to see where that data is located.
It does not write a keyword tag.
exiftool -keywords -r '/volume1/homes/username/Photos/SORTED/DJI/test/DJI_AIR_2S/2021/09/09/Plex Versions/Optimized for TV' -i '@eaDir' -ext mp4
Then it won't show any keywords.
I suggest you break it down and run each command manually to see what is going wrong. There's nothing obviously wrong with your command.
I have now rearranged the commands and now it works. :D
DIR='/volume1/homes/username/Photos/SORTED'
find $DIR -type f -name '*.mp4' -path '*/Plex Versions/*' ! -path '*/@eaDir/*' > $DIR/temp.txt
# exiftool \
# -@ $DIR/temp.txt \
# -Keywords='Plex' \
# '-*Date<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' -wm w \
# '-FileModifyDate<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' \
# -api QuickTimeUTC \
# -overwrite_original \
# -progress
exiftool \
'-*Date<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' -wm w \
'-FileModifyDate<${FileName;s/.*(\d{4}-\d{2}-\d{2}_\d{2}.\d{2}.\d{2}).*/$1/}' \
-api QuickTimeUTC \
-overwrite_original \
-Keywords='Plex' \
-@ $DIR/temp.txt \
-progress
exiftool -a -s -G1 -time:all -Keywords -@ $DIR/temp.txt
rm $DIR/temp.txt