On the exiftool web page:
http://www.sno.phy.queensu.ca/~phil/exiftool/
It shows this example:
Code:
exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" DIR
Your quoting is different. I suggest changing your quoting to match the example.
In particular, make sure the percent symbols are enclosed in quotes. Bash uses % as job control identifiers, so unquoted percents are vulnerable to bash substitution.
You can inspect the commands the shell executes by adding this line before your 'for' loop:
The output will be every command, fully expanded. You can read about this option in the bash man page.
If you don't see a problem, then post the output and maybe someone else will.
You can also do a number of simplified tests:
1. Replace the 'exiftool' line with a simple echo "$f"
2. Replace the 'exiftool' command in the original line with 'echo'.
In short, break it down, try parts one by one, and observe output to see what actually happens.