Inactive Tutor answered 10d
Use the MetadataExtractor NuGet package. It's free, cross-platform, and reads EXIF from JPEGs (plus RAW, HEIC, PNG, and more) without any Windows-only dependencies.
Reading date taken and exposure, then moving the file:
csharp
A few things worth knowing:
-
Use DateTimeOriginal, not DateTime.
TagDateTimeOriginalis when the shutter fired. The plainDateTimetag (in IFD0) often gets overwritten when you edit the file. - No time zone. EXIF dates are camera local time, with no offset. If your camera clock was wrong or you traveled, you'll see it here.
-
Other useful tags in the same directory:
TagFNumber,TagIsoEquivalent,TagFocalLength. Camera make and model live inExifIfd0Directory. -
Name collisions. Two cameras can both produce
IMG_0001.jpgon the same day, so checkFile.Existsbefore moving or you'll get an exception.
The taken.ToString(...) line is where your dating convention goes.