I have a folder in which log files are created continuously through a file simulator. On completion of creation of each file, a background windows service which is a FolderWatcher
, should copy each file to a central windows server.
I have used File.Copy()
to transfer the files from one machine to another. The issue is my background windows service is not able to know whether the file to be copied is still in use.
Is there any way to know that the file is still in use? I know if we try to open the file which is in use, it will throw exception.