Exception while copying a file to network driive
- From: ".Net Believer" <NetBeliever@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 24 Apr 2005 14:04:06 -0700
I using the routine below to copy file to a network drive for a regular
backup process. Before calling this routine I using another function to check
the presence of the LAN connection and the server where the network drive
exists.
Although of this check I am sometimes(5% of times) getting an error saying
"Could not find the U:\...\File.ext" or part of its path" Although the
network dirve is available and accessible by windows explorer and the path is
correct and
existing.
I would apreciate if some one can help me troubleshooting this unexpected and
non understandable exception.
Private Sub CopyFile(ByVal DstBasePath As String, ByVal SrcFileInfo As
FileInfo)
Try
Dim strDstFile As String = DstBasePath &
SrcFileInfo.FullName.Substring(2)
Dim DstFileInfo As New FileInfo(strDstFile)
If DstFileInfo.Directory.Exists = False Then
DstFileInfo.Directory.Create()
End If
Me.c_Status = String.Format("Copying {0}{1}To {2}", SrcFileInfo.Name,
vbCrLf, DstBasePath)
Me.c_Progress += 1
Me.c_FCD_Status.Invoke(SrcFileInfo.Name, Me.c_Progress, Me.c_Status,
True)
If DstFileInfo.Exists = False Then
SrcFileInfo.CopyTo(DstFileInfo.FullName)
ElseIf DstFileInfo.LastWriteTime <> SrcFileInfo.LastWriteTime Then
SrcFileInfo.CopyTo(DstFileInfo.FullName, True)
End If
Catch exIO As IOException
Catch ex As Exception
End Try
End Sub
.
- Follow-Ups:
- Re: Exception while copying a file to network driive
- From: Randy Birch
- Re: Exception while copying a file to network driive
- Prev by Date: Re: datediff bug between vb6/vbscript and vb.net
- Next by Date: Re: Exception while copying a file to network driive
- Previous by thread: 2147417848 : Method '~' of object '~' failed" with Mapi session object
- Next by thread: Re: Exception while copying a file to network driive
- Index(es):
Relevant Pages
|