0

I'm building an application that takes data input from a csv text file. This file is being continually overwritten populated from our ERP system. We need to understand if there is a delay when the file gets updated. So I need to know if (for example) this file has not been updated within the last 10 minutes.

Is there a way that I could create a control or something to continually check this file and report an error if the file has not been updated within a certain time frame?

Andy
  • 383
  • 1
  • 6
  • 23

1 Answers1

0

You could create a program that checks the last time that the csv file was written to using System.IO.File.GetLastWriteTime. Compare the newest time to the previous last modified time and you can see if the csv file is actually being updated as you expect.

There are many ways that you can have it report if the file is not being updated. It depends on what exactly you are looking for here. Is this going to be a service that you want to always tell you when the file has not been updated or are you just using it one time to see if there is a delay?

Jason
  • 44
  • 5
  • I have an aspx page that shows a chart that derives some of it's data from this file. What would be great if I had a label that changes it's text to "Warning: File has not been updated within 10 minutes." as soon as it's been over 10 minutes. – Andy Sep 28 '15 at 13:20