System.IO.File.GetLastWriteTime takes a very long time to return results

  • Thread starter Thread starter grt3kl
  • Start date Start date
G

grt3kl

Guest
Does anyone know of any known problems with File.GetLastWriteTime? When I use it in the following code, it literally takes upwards of 30 seconds to retrieve the results. If I only return the filenames (and not the last time the files were written to), the results will be returned in about 1 second. I'm not sure if I am doing something wrong or if there is perhaps a known problem with this. Any feedback or help is greatly appreicated. Thanks!
-Greg

Code Block

private void button3_Click(object sender, EventArgs e)
{
string terminal = textBox1.Text;
string[] files = Directory.GetFiles(@"\\" + terminal + "PC01" + @"\C$\OUTPUT");

foreach (string file in files)
{
dataGridView1.Rows.Add(file.Substring(28, file.Length - 28),File.GetLastWriteTime(file));
}
}


Continue reading...
 
Back
Top