Reputation: 11010
Is it possible to get a datetime of a file which is located inside a folder...
the folder structure is like dotnet\build\portalFlexLib.swc
I need to get the datetime of portalFlexLib.swc
without giving harcore value..
I have tried like this
DateTime ftime = File.GetCreationTime(txtBoxInput.Text);
It give only the folder datetime...Any suggestion??
Upvotes: 0
Views: 3438
Reputation: 432
Maybe you could try with FileInfo class?
Fileinfo myFileInfo = new Fileinfo(@"C:\path\to\file");
DateTime ftime = myFileInfo.CreationTime;
There's the UTC version too;
Datetime ftime = myFileInfo.CreationTimeUtc;
Upvotes: 4
Reputation: 22555
Yes You can do this by file info.
var f= new FileInfo(fileName);
var creationDate = f.CreationTime;
Upvotes: 1