File.Copy problem

  • Thread starter Thread starter Pete Davis
  • Start date Start date
P

Pete Davis

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
 
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?
 
Sorry, my bad. Finally found it. There was an extra \ in there. Just hard to
see in the debugger.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top