Hi, what i am doing is to create a dir watcher which will watch the dir for example "A" and copy the file of certain name to another folder once it sees the file in the dir A to destination dir B. I dropped the file to the Dir A and it worked. but when i ran the program in my local machine and set dir to be watched and destination dir in server, it throws me the following error.
How do i handle it?
Unhandled Exception: System.IO.IOException: The process cannot access the file '\\IP-exapp-101\c$\WorkDir\WatchedDir\_f$12345.dat' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName)
at iSpy_File.Program.OnChanged(Object source, FileSystemEventArgs e) in c:\users\xuser\documents\visual studio 2015\Projects\iSpy_File\iSpy_File\Program.cs:line 68
at System.IO.FileSystemWatcher.OnCreated(FileSystemEventArgs e)
at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action, String name)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Salman BegPosted Apr 28, 2017, 3:28 AM