473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

File.Copy problem

I'm getting an exception when trying to copy a file.

I basically do a File.Copy(source, dest, false);

source is the source full path and filename. dest is the destination full
path and filename.

The file actually appears to copy just fine. The problem is it throws an
IOException with the message:

Could not find a part of the path "path\filename."

Where path\filename is the destination full path and filename just as it was
passed to File.Copy.

The destination file does not exist prior to the copy, but it does after the
copy despite the exception. The exception is thrown regardless of whether
the last parameter is true or false.

Anyone know what's causing this?

BTW, source and dest are the local drive. This is a Windows.Forms app. There
shouldn't be any file permission issues.

Pete
Nov 17 '05 #1
2 5487
Sorry, my bad. Finally found it. There was an extra \ in there. Just hard to
see in the debugger.

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:Kp********************@giganews.com...
I'm getting an exception when trying to copy a file.

I basically do a File.Copy(source, dest, false);

source is the source full path and filename. dest is the destination full
path and filename.

The file actually appears to copy just fine. The problem is it throws an
IOException with the message:

Could not find a part of the path "path\filename."

Where path\filename is the destination full path and filename just as it
was passed to File.Copy.

The destination file does not exist prior to the copy, but it does after
the copy despite the exception. The exception is thrown regardless of
whether the last parameter is true or false.

Anyone know what's causing this?

BTW, source and dest are the local drive. This is a Windows.Forms app.
There shouldn't be any file permission issues.

Pete

Nov 17 '05 #2
Pete,

Are you sure the inputs are correct, in the sense that the source and
destination are correct?

Can you reproduce the problem in a short example and post it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:Kp********************@giganews.com...
I'm getting an exception when trying to copy a file.

I basically do a File.Copy(source, dest, false);

source is the source full path and filename. dest is the destination full
path and filename.

The file actually appears to copy just fine. The problem is it throws an
IOException with the message:

Could not find a part of the path "path\filename."

Where path\filename is the destination full path and filename just as it
was passed to File.Copy.

The destination file does not exist prior to the copy, but it does after
the copy despite the exception. The exception is thrown regardless of
whether the last parameter is true or false.

Anyone know what's causing this?

BTW, source and dest are the local drive. This is a Windows.Forms app.
There shouldn't be any file permission issues.

Pete

Nov 17 '05 #3

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

Similar topics

1
by: Tony George | last post by:
Hi, I'm having a problem using the Copy module on a ClearCase view that's been set as "readonly" (i.e. ct chview -readonly <view tag>). I want to copy a file out of this view and put it in...
11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
8
by: luis molina Micasoft | last post by:
it seems that when i do file.copy the svchost.exe is hanged, i mean if i make 40 threads of file.copy , 40 copys of files at same time the system is going down and stop responding, this is when i'm...
8
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...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
6
by: elake | last post by:
I found this thread about a pst file in Windows being locked and I am having the same issue. ...
3
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. ...
3
by: =?Utf-8?B?R2FuZXNoYQ==?= | last post by:
Hi I would like to use File.Copy with UNC paths. I have seen this problem reported by others as well. Can i use File.Copy with UNC paths. ie., i would like to copy a file from one of the folder to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.