Something I've just noticed.
exiftool -xmp:datetimeoriginal *.jpg
produces an output list sorted by date (after using utime in Perl) whilst
exiftool -xmp:datetimeoriginal -ext jpg .
appears to be unsorted.
While I can't explain why it would be different between the two, I believe there are some other things to check. For example, are the file names in the same order as the
DateTimeOriginal?
IIRC, exiftool gets the file list from the OS. Ah, found the post.
Quote from: Phil Harvey on October 09, 2015, 07:15:39 AM
ExifTool renaming order is consistent. When processing files in a directory, ExifTool uses the native system directory order (on Mac and Linux, this is alphabetical; on Windows, it is probably the order of the entries in the FAT). But you can use the -fileOrder option to specify any other order you want.
In my experience, under Windows NTFS, it's pretty much alphabetical. But it can be different depending upon other things. For example, I use StableBit DrivePool. If the directory has files on different underlying drives, it will return the filelist alphabetical for each of the underlying drives.
It's certainly not alphabetical order. -ext jpg seems to be the same order as -f (not sorted) under bash on macos.
This is not actually a problem. It's just something I've noticed because I've always used *.whatever rather than -ext whatever.
Date/Time Original : 2019:11:06 10:49:38-04:00
======== ./w300_1396.jpg
Date/Time Original : 2019:11:13 10:32:08-04:00
======== ./w300_1416.jpg
Date/Time Original : 2019:11:13 12:50:59-04:00
======== ./w300_1402.jpg
Date/Time Original : 2019:11:13 10:52:49-04:00
======== ./w300_1403.jpg
Date/Time Original : 2019:11:13 10:52:57-04:00
======== ./w300_1367.jpg
Date/Time Original : 2019:11:06 10:19:54-04:00
======== ./w300_1401.jpg
Date/Time Original : 2019:11:13 10:50:01-04:00
======== ./w300_1415.jpg
Date/Time Original : 2019:11:13 12:50:51-04:00
======== ./w300_1398.jpg
Date/Time Original : 2019:11:13 10:49:28-04:00
There are 6 different ways that the file list may be generated:
On Mac/Linux, "*.jpg" is expanded by the shell, and I think the order is usually alphabetic. On Windows, it is expanded by ExifTool using Win32::FindFile::FindFile if available, otherwise File::Glob::bsd_glob if available, otherwise the built-in Perl glob function. I don't know if the order of any of these is specified.
When -ext is used, the directory is listed with Win32::FindFile::ReadDir if available on Windows, otherwise the built-in Perl readdir function. As far as I know, the order of the files returned by these is not specified.
ExifTool makes no claims about the processing order of the files unless the -fileorder option is used.
- Phil
Quote from: Phil Harvey on November 15, 2019, 04:11:43 PM
On Mac/Linux, "*.jpg" is expanded by the shell, and I think the order is usually alphabetic.
...
ExifTool makes no claims about the processing order of the files unless the -fileorder option is used.
Yes, in my example directory, alphabetic and date were the same. But alphabetic it is when that is not the case. I'll just have to get into the habit of using -fileorder.
I'll see about making -fileOrder more efficient if you want to just check the file attributes.
- Phil
Quote from: Phil Harvey on November 15, 2019, 07:56:52 PM
I'll see about making -fileOrder more efficient if you want to just check the file attributes.
- Phil
Thank you Phil but don't do any extra work just for me. It's all fast enough as it is.
Well, anyway... ExifTool 11.77 will enhance the -fileOrder option to add a fast feature. (Similar to the fast feature of the -if option.)
- Phil