Guest User

Guest User

  • Tech Writer
  • 77
  • 12.9k

help me with creation time and last write time of file inside folder

Jul 13 2020 4:22 AM
hi, wanna ask for help
 
In code below, I will get creation time and last write time of a root folder, but how do I want to get creation time and last write time of files inside root folder.
 
For example, in the root folder, I have 3 more text files, how to get the creation time, and last write time of that 3 text files using c#.
 
 FileInfo fileInfo = new FileInfo(@"C:\ipub\root");
DateTime creationTime = fileInfo.CreationTime;
DateTime lastWriteTime = fileInfo.LastWriteTime;
DateTime lastAccessTime = fileInfo.LastAccessTime;
 
MessageBox.Show("Time create : " + creationTime);
MessageBox.Show("Time Edit : " + lastWriteTime);
 
help me
thank you 
I'm using visual studio 2019, c#

Answers (4)