TryUpdate for supporting override
Dim destDir As String = Path.GetDirectoryName(destFilePath)
If (Not System.IO.Directory.Exists(destDir)) Then
System.IO,Directory.CreateDirectory(destDir)
End If
Dim fr As New FileInfo(sourceFilePath)
fr.CopyTo(destFilePath)
Catch ex As Exception
outMessage = ex.Message
End try
Try
Dim destDir As String = Path.GetDirectoryName(destFilePath)
If (Not System.IO.Directory.Exists(destDir)) Then
System.IO,Directory.CreateDirectory(destDir)
End If
Dim fr As New FileInfo(sourceFilePath)
fr.CopyTo(destFilePath, True)
Catch ex As Exception
outMessage = ex.Message
End try
Reference:
https://stackoverflow.com/questions/13406225/file-already-exist-using-system-io-file-copy
No comments :
Post a Comment