I am trying to copy files from one directory to another and test based on the file creation date.
File.Copy(fileName, directory + fileNameOnly, true);
The problem occurs later in my program when I checked the creation date to make sure it is no more than 5 days old.
FileInfo file = new FileInfo(fileName); if (file.CreationTime.AddHours(120) < DateTime.Now) {}
I saw that the creation date when copying back is set to 1980-01-01. This is not useful for my requirements, since I would like to save the creation date from the source file. Is there any other method for comparing dates or is it a copy that loses the value of the creation date.
I think my question is, how can I save the creation date?
Mr. Mr.
source share