Okey, I'm trying to do a simple script in batch (CMD, Windows) where I take a folder full of pictures (all with the same date and time) and start adding 3 or 5 minutes to each one so they don't appear to be taken at the exact same moment. So far it's fine, just a FOR with a counter and shifting minutes.
The thing is, now I have a folder with pictures from different days, and the way I designed the script, the counter starts in 0 and goes 5, 10, 15, 20, etc... I'd like to reset the counter whenever I change days, and in order to do that, I'd like to be able to store the DateTimeOriginal tag in a variable to then compare. Something like this:
SET previous_date=exiftool -DateTimeOriginal C:\MyImages\IMG_001.jpg
SET current_date=exiftool -DateTimeOriginal C:\MyImages\IMG_002.jpg
IF previous_date NEQ current_date (SET counter=0)
Well, as you probably already noticed, that pseudo-script does not work because ECHO %previous_date% will show exiftool -DateTimeOriginal C:\MyImages\IMG_001.jpg and not the actual value of the tag.
Is there a way to return the tag value so that I can store it (as a string, or whatever, I'll figure that later)?
First of all, I must apologize because turns out my issue was my lack of knowledge in Batch scripting rather in Exiftool scripting. That is, the solution is as simple as using a FOR /F loop. I will, however, leave this post in case anyone has a similar problem (although I don't think anyone will).
My solution:
FOR /F "tokens=*" %%D IN ('exiftool -p "$DateTimeOriginal" C:\MyImages\IMG_001.JPG') DO (SET current_date=%%D)
Now, ECHO %current_date% will display 2020:08:13 18:33:15, if that were the value of the Date/Time Original tag.
There are lots of posts in here about people trying to do the same thing. You don't need a batch file.
Basically the command is (for 5 minute spacing):
exiftool "-datetimeoriginal+<0:${filesequence;$_*=5}" DIR
- Phil
That works for what they did in the first paragraph, but now they want a reset upon each change of day.