471,353 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Renaming folder problems


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!
*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
1 930
On Sun, 04 May 2008 05:38:30 -0700, csharpula csharp
<cs*******@yahoo.comwrote:
>
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.

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by MikeY | last post: by
3 posts views Thread by MisterG | last post: by
1 post views Thread by Jason B | last post: by
8 posts views Thread by BillCo | last post: by
1 post views Thread by evaisse | last post: by
2 posts views Thread by djcamo | last post: by

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.