I have a working GPS and date combined search as per the script below. Unsurprisingly it complains about duplicate files. Apologies if a FAQ but how can I get the program to auto renumber duplicates. I tried using all combinations of the %c formatting I could think of but nothing seems to work.
#!/bin/bash
echo "search_name latitude longitude margin 1e-4 and eg dates 2019:01:01 2020:12:31"
mkdir -p $HOME/GPS_Search/"$1"
exiftool -if \
'($createdate# gt "'$5'") and ($createdate# lt "'$6'") and \
(abs($gpslatitude# - "'$2'") < "'$4'") and (abs($gpslongitude# - "'$3'") < "'$4'") ' \
-o $HOME/GPS_Search/"$1" -r .
Does $1 contain a filename or a path? If the latter then try something like
-o $HOME/GPS_Search/"$1"/%f%-c.%e
If the former, than you'll probably have to parse that somehow before passing it to exiftool.
Its just an output directory. thanks
eg
exiftool_find_GPS_and_date CornExchangeCambridge 52.1 0.11 0.01 "2021:03:01" "2021:03:30" 2>/dev/null
creates an output directory with the name CornExchangeCambridge to hold the results
Try making the command work on the command line before trying to put it in a script.
Greetings Richard.
This what Im learned from the experiments: The only way to fix is using the variables like StarGeek says.
Because if $1=CornExchangeCambridge, and there is not already a folder named CornExchangeCambridge...
Then for every input file, exiftool tries to create 1-file called.. "CornExchangeCambridge"
But with $1/%f%-c.%e, it instead names the duplicates like. "CornExchangeCambridge/InputName-#.ext"
But even with using $1/ or passing CornExchangeCambridge/ to say FolderNameOnly...
Then for every input file, exiftool tries to create a file called.... "CornExchangeCambridge/InputName.ext"
So there could never be a second file with the same InputName.ext, because nothing is using %c.
So if you already experimented with %c, Im thinking the quotes did probably just get typod somehow.
I see many quotes here like -o '/Path/%f%-c.%e', but not knowing how this changes inside the scripts????
For me, its Windows wanting things more like "%%c", so Im interested to see how to fix your script.