What process is holding a file?
Posted on 2004-04-07
Does anyone know how to find out what process is holding a file?
My program has to parse *.txt file after file has been copied to "C:\temp\" folder
The problem is that FileSystemWatcher.OnCreated evet fires the moment file is created (while still it is being copied)
I get an error "Additional information: The process cannot access the file because it is being used by another process."
Dim watcher As New FileSystemWatcher
watcher.Filter = "*.txt"
watcher.Path = "C:\temp\"
AddHandler watcher.Created, AddressOf OnCreated
watcher.EnableRaisingEvents = True
Private Shared Sub OnCreated(ByVal source As Object, ByVal e As FileSystemEventArgs)
'do some parsing....