Renaming folder problems

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,
I am trying to rename a folder by using
Directory.Move(soucrceFolder,destFolder) but keep getting the following
error:
Cannot create a file when that file already exists.

Why can it happen? Thanks!
 
Hello,
I am trying to rename a folder by using
Directory.Move(soucrceFolder,destFolder) but keep getting the following
error:
Cannot create a file when that file already exists.

Why can it happen? Thanks!

Quoting MSDN:

"This method throws an IOException if, for example, you try to move
c:\mydir to c:\public, and c:\public already exists. You must specify
"c:\\public\\mydir" as the destDirName parameter, provided that
"mydir" does not exist under "c:\\public", or specify a new directory
name such as "c:\\newdir"."

What are the specific values for "sourceFolder" and "destFolder" in
your case? Does "destFolder" already exist?

Regards,
Gilles.
 
Back
Top