Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert String to file object

Status
Not open for further replies.

EzehM

Programmer
Feb 27, 2003
86
GB
I am trying to get file attributes or to be more specific the creation date of files stored in a string array.

This is my code
string[] dirs = Directory.GetFiles(dirToSearch, "*ack");
Console.WriteLine("The number of files starting with ack is {0}.", dirs.Length);
foreach (string dir in dirs)
{
Console.WriteLine(dir);
}

How can I get the creation date of the files that I am looping thru?

Thanks in advance
 
Thanks


This does the trick

FileInfo fi = new FileInfo(dir);
Console.WriteLine("Creation time {0} ", fi.CreationTime);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top