Question about using DirectoryInfo for real LastWriteTime

Oct 16 2006 10:38 PM
Hello, I'm currently writing an application, part of which involves watching a target directory, and sending notification to the main interface when a subdirectory is dropped into this target directory. However, I'm running into a slight issue which I'm hoping someone here can clarify for me.
The snag that I'm running into is that before I can call the code to process these subfolders, I need to be sure that they have been completely finished being sent. In the code that I have in place now I use this:

if (dir.LastWriteTime.AddSeconds(5) < DateTime.Now)

This code doesn't seem to be reliable if files inside the folder are taking a long time to copy. Does the LastWriteTime property not check the files within the directory to see what time they were last accessed? Does it check the files inside that particular directory, but not the subdirectories inside? I couldn't really glean the information from the SDK, so I figured that I would ask here and see if anyone could clear this up.

Thanks in advance, Christoff