I am using following code to copy remote file to local. How do you detect failure in the operation, when copying large files.
Is there any better approach to detect failure, apart from handling system.io exception ?
File.Copy(remoteSrcFile, dest);
Is this the best method offered by framework to copy large files whose file size is in gigabyte range ?
Is there any better approach to detect failure, apart from handling system.io exception?
Many possible errors, such as an invalid file name, can be checked beforehand. If File.Copy fails, it will throw an exception. There is no other error indicator.
Is this the best method offered by framework to copy large files whose file size is in gigabyte range ?
It depends on what other features you want. For example, if you want to show progress, File.Copy will not help you, since it just wraps the FileCopy API. However, calling the Windows API FileCopyEx can provide progress. See Can I show file copy progress using FileInfo.CopyTo() in .NET? for more info.