Select -if date range

Started by durianwool, June 02, 2021, 11:03:48 PM

Previous topic - Next topic

durianwool

Hi,
I am not sure what I am doing wrong. As per this post https://exiftool.org/forum/index.php?topic=2129.0 , I should be able to conditionally only process with exiftool using the following:

$ exiftool -if "$CreateDate gt '2020:01:01'" -s -time:all IMG_0050.jpg
    1 files failed condition


where I've checked ...

$ exiftool -s -time:all IMG_0050.jpg
(snipped...)
DateTimeOriginal                : 2021:02:18 08:11:07
CreateDate                      : 2021:02:18 08:11:07
(...)

My usage is to select and process files in a date range, and then output those files to another command. Eg...

exiftool -if "$CreateDate ge '2020:01:01' and $CreateDate lt '2021:01:01'" -p "$FileName" | commandx

Actually I just like to move (or copy) all files with above condition to another directory. Is there already a way to do that in exiftool?

Thanks in advance.



StarGeek

You appear to be using a bash type shell.  As per the .sig on any of Phil's posts, you want to swap double/single quotes because otherwise the shell will interpret the $ as the start of a variable. 

To move a file, use the Directory tag (see Writing "FileName" and "Directory" tags)

exiftool -if '$CreateDate ge "2020:01:01" and $CreateDate lt "2021:01:01" ' -directory=/path/to/new/directory /path/to/source/files/
"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

durianwool

Oh ... I didn't notice that .sig. It works now! Thanks!