I have some pictures with date created set to when I unzipped them and date modified set to some strange moment in the past. However, the 'Date' attribute shows a coorect creation time (the time when I actually took these pictures). Is there a way to access that attribute in C# ? Both File.GetCreationTime
and FileInfo.CreationTime
give me the incorrect 'Date created'.
This is what I tried:
var allFiles = Directory.EnumerateFiles(".");
foreach (var s in allFiles)
{
Console.WriteLine(s + " " + File.GetCreationTime(s));
}
DirectoryInfo dir = new DirectoryInfo(".");
FileInfo[] files = dir.GetFiles().OrderByDescending(p => p.CreationTime).ToArray();
foreach (var f in files)
{
Console.WriteLine(f.Name + " " + f.CreationTime + "/" + f.LastAccessTime + "/" + f.LastWriteTime);
}
EDIT:
This 'Date' is actually a 'Date taken' field and it's not a file attribute but a part of metadata of the image files.