I have a large log file located on a network drive that is being constantly written to. How can I copy it through code without locking it?
Try
Microsoft.VisualBasic.FileSystem.FileCopy("sourcefile", "destinationfile")
Catch ex As Exception
' Handle Error
End Try
The code above, unfortunately does not work well, because while its copying the file, nothing can be written to that file.
Edit 1: It was suggested to read the content of the file and write it to the output. I would prefer not to do this, because the file is several gigabytes. I reserve this option only as a last resort, only if there is no other way to copy the file without locking it and without readying the content.