Wildcard with iif and $filename

Started by ericconn, September 11, 2024, 12:05:00 PM

Previous topic - Next topic

ericconn

I'm having issues with a command to copy out files that don't have a filename matching yyyy-mm-dd_initials_####.jpg. I'm assuming I can do this type of command to begin with, so could you please let me know what I'm missing below? Thanks. This is for Windows.

exiftool -if "$Filename=~/20*-*-*_*_*.jpg/i" -o "C:\Test\FilenameIssue" "C:\Test"

StarGeek

The asterisk * in this part
$Filename=~/20*-*-*_*_*.jpg/i"
is not a wildcard in the same way as it would be on the command line. The =~ indicates a Regular Expression (RegEx) and the asterisk has an entirely different meaning. In RegEx, it means the previous character is repeated 0 or more times. So 0* means that 0, 0000, 000000000, and no 0s at all will match.

You might try this instead
-if "$Filename=~/20.*?-.*?-.*?_.*?_.*?\.jpg/i"
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype