Is it safe to use something like this to ensure that a directory isn't currently being written to?
Dim ImportDir As New DirectoryInfo("C:\MyPath\")
If DateDiff(DateInterval.Minute, ImportDir.LastWriteTime, Now) < 10 Then
Exit Sub
End If
I'm processing images which can be up to 10MB so my main concern is that I'm not sure whether the LastWriteTime property (which presumably references the filesystem 'last modified' meta data) is updated when the first, last or every byte of a file is written to disk.
Files will generally be uploaded via IIS7 FTP to an NTFS Filesystem on a Windows 2008 server. If it's filesystem-dependant though it would be good to also know which filsystems update when.
EDIT: I'd hoped that this could be used to simplify the programme by ensuring that the whole directory was processed at once. In the end I decided to rethink that since the workarounds are messier and less reliable than the one I was trying to avoid! Cheers for the answers though