if datetimeoriginal earlier that 1990 move to folder command

Started by curtistealer, April 25, 2022, 07:37:00 AM

Previous topic - Next topic

curtistealer

exiftool '-Directory<DateTimeOriginal' -d /Volumes/id/original/%Y/%-m/%-d -r -progress:%20b -if '$datetimeoriginal lt "1990:01:01" ' /Volumes/id/original/2012/3/7/.

Only if file date/time original is earlier than 1990, move to folder format YYYY/M/D/

but it process all the files including later than 1990.

I am running on mac.

What Am i missing?

StarGeek

The -d (-dateFormat) option changes the format of date/time data globally, so when you compare
-if '$datetimeoriginal lt "1990:01:01" '
you are comparing 1990:01:01 to /Volumes/id/original/####/##/## and since the slash (ASCII value 47) is just before all numbers (ASCII 48-57), this will always be true.

You'll want to use the -n (--printConv) option, specifically the hashtag version to disable the PrintConv for the compare time stamp.

exiftool '-Directory<DateTimeOriginal' -d /Volumes/id/original/%Y/%-m/%-d -r -progress:%20b -if '$datetimeoriginal# lt "1990:01:01" ' /Volumes/id/original/2012/3/7/.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

curtistealer

#2
Quote from: StarGeek on April 25, 2022, 10:23:02 AM

exiftool '-Directory<DateTimeOriginal' -d /Volumes/id/original/%Y/%-m/%-d -r -progress:%20b -if '$datetimeoriginal# lt "1990:01:01" ' /Volumes/id/original/2012/3/7/.


works like charm!
Thank you!
exiftool '-Directory<DateTimeOriginal' -d /Volumes/id/original/%Y/%-m/%-d -r -progress:%20b -if '$datetimeoriginal# gt "1990:01:01" ' /Volumes/id/original/2012/3/7/.
What if I want to move only files that condition meets(DateTimeOriginal is later than 1990:01:01) and rest of them(which is DateTimeOriginal is earlier than 1990:01:01, edit -datetimeoriginal based on folder hierarchy 20120307.

Is it possible with one single command?