473,544 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exception while copying a file to a network drive

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 getting an exception (in 5% of
times)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 troubleshooting this unexpected and
non understandable error.

Private Sub CopyFile(ByVal DstBasePath As String, ByVal SrcFileInfo As
FileInfo)
Try

Dim strDstFile As String = DstBasePath &
SrcFileInfo.Ful lName.Substring (2)

Dim DstFileInfo As New FileInfo(strDst File)
If DstFileInfo.Dir ectory.Exists = False Then
DstFileInfo.Dir ectory.Create()
End If

Me.c_Status = String.Format(" Copying {0}{1}To {2}", SrcFileInfo.Nam e,
vbCrLf, DstBasePath)

Me.c_Progress += 1

Me.c_FCD_Status .Invoke(SrcFile Info.Name, Me.c_Progress, Me.c_Status,
True)

If DstFileInfo.Exi sts = False Then
SrcFileInfo.Cop yTo(DstFileInfo .FullName)
ElseIf DstFileInfo.Las tWriteTime <> SrcFileInfo.Las tWriteTime Then
SrcFileInfo.Cop yTo(DstFileInfo .FullName, True)
End If

Catch exIO As IOException

Catch ex As Exception

End Try

End Sub
Nov 21 '05 #1
2 2661
Hi

Looking through your question. Please tell me the answers to these
questions:

1) What is c_Status?
2) What is c_Progress? I think an Integer, but why are you using this if you
aren't using a recursive copy?
3) What is c_FCD_Status?
4) Is youe U:\ drive original or destination directory?
5) Have you tried an UNC path instead? Example: \\MyServer\MyPa th etc.
6) Why are you creating a directory based on the filename?
7) Do you have to use FileInfo instead of a string for the srcFileInfo?
8) What file permissions are you using to copy a file over a network drive?

Awaiting your answers

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Thank you for your time looking at my question. Here's the answers:
1- c_Status is string e.g. "Copying xxx.yyy to c:\dstDir"
2- c_Progress is integer and it is used because the routine is recuresive
it's called with a loop in another routine.
3- c_FCD_Status is "Private c_FCD_Status As FileCopierStatu s" where
FileCopierStatu s is "Delegate Sub FileCopierStatu s(ByVal FileName As String,
ByVal Progress As Integer, ByVal strStatus As String, ByVal Status As
Boolean)"
4- "U:\" is the distination directory and it's a mapped drive. On our
network there is a personal network drive for each user that is noly
accessible by the user only and mapped to "U:"
5- I have not try the UNC because the network drive is mapped on every
target machine as said the previous point.
6 & 7- are not clear form. What's the point?
8- I don't use a file permession to copy the file over the network, because
the user is having full control over his network personal drive "U:\" see
note: 4

Just to clarify When run this routin 100 times it gives the error message on
about 5 times out of the 100. So it's working fine but for know reason it
gives the exception "Couldn't find path U:\...\file.xxx " which means there's
a problem to access the destination file.

Also it could help if I mentioned this error is happening at the CopyTo
method of the FileInfo class, so you can forget about other lines in my code
because there a many other detatils that can not be given in such short note

Thanks in advance.

"Crouchie19 98" wrote:
Hi

Looking through your question. Please tell me the answers to these
questions:

1) What is c_Status?
2) What is c_Progress? I think an Integer, but why are you using this if you
aren't using a recursive copy?
3) What is c_FCD_Status?
4) Is youe U:\ drive original or destination directory?
5) Have you tried an UNC path instead? Example: \\MyServer\MyPa th etc.
6) Why are you creating a directory based on the filename?
7) Do you have to use FileInfo instead of a string for the srcFileInfo?
8) What file permissions are you using to copy a file over a network drive?

Awaiting your answers

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1473
by: Richard Jonas | last post by:
I've written a Windows Application in C#.net that runs in the background and silently archives files to a network drive (using the System.IO.File.Copy function). Sometimes, users may run this application when connected to our network via a dial-up connection. This means that files take a long time to copy. If users try and shut down...
0
1531
by: Oliver | last post by:
Hello, I may have posted in the wrong place, if so, feel free to move my post (just notify me where you put it via email or something) I’m having a problem with my program that I cant readily explain. The program connects to, then reads and creates a new flat old Dbase files (.DBF) stored on a network drive. The program itself is run...
4
1931
by: Boris | last post by:
I observe the following strange behavior of my application. Let say we have managed application MyApp.exe which depend on a few assemblies MyAssembly1.dll, MyAssembly2.dll and MyAssembly3.dll. The assemblies I mentione have strong names. I build the exe and all assemblies on my computer and install assemblies to GAC. I run MyApp.exe, test...
14
2308
by: frostalicious | last post by:
Used VB.NET (on my client PC) to convert VB6 executable to .NET executable. Placed the .exe file on a network drive on my server. From client, ran .NET Wizards "Trust an Assembly" to make the .exe (on the network drive, on the server) "Full Trust." From the client, double-click on the ..exe (on the network drive, on the server) and it runs...
8
9707
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC...
0
930
by: Alex Wieder | last post by:
Hi, I'm having a crazy error happening randomly on a console application that copies files from a Novell server to the local hard disk, zips them, and then ftp's them to yet another computer: System.IO.FileNotFoundException: Could not find file "f:\Case.dbf". F: is a drive in a novell 4.11 server. E: is a drive in the local machine...
3
1341
by: Jeries Shahin | last post by:
Hi I am trying to copy files from a folder on a Novel machine, the folder is in the UMC format (i cannot map a network drive for some business reasons). Upon copying, it fires an IOException saying that the file does not exist. Any idea how can I do it? (the user copying is the Novel Administrator)
8
7693
by: jporter188 | last post by:
Hello, I am working on a project to manipulate XML files. All of the files, the code, and the output are on network drives. When I run my program I get an exception (see below). I tried giving the LocalIntranet_Zone full permissions in the .NET Framework 2.0 Configuration msc. This had no effect whatsoever. What do I need to do to fix this?...
0
1332
by: SniperDemon | last post by:
Background: The Program runs a query on a SQL Database, then it takes the gathered information and outputs it into an excel document and saves it to a specified location. Problem: I currently have a check in the Form1_Load that checks to make sure the Program is not being run from a network location. It does this by trying to create Folders...
0
7431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5920
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4924
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1848
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
674
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.