I have a file which I am copying to some location. Below is the code snippet -
//Document Status = Pending
var triggerFileWriter = new StringWriter();
triggerFileWriter.WriteLine("Only for test");
System.IO.File.WriteAllText(fullTriggerFilename, triggerFileWriter.ToString());
triggerFileWriter.Dispose();
if (System.IO.File.Exists(fullTriggerFilename))
{
// Document Status = Processed
}
Is File.Exists
check sufficient to update the document status?
I am not worried about if file is not copied over and document status not updated. Because there is a timer job running every 10 minutes, 'Pending' items will be automatically picked up in the next run.
Is there any possibility of file copying being interrupted - which can result in a file but not actually copied completely? What changes I can make to my code to address if that happens.
Thank you!