Renaming folder problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • csharpula csharp

    Renaming folder problems


    Hello,
    I am trying to rename a folder by using
    Directory.Move( soucrceFolder,d estFolder) 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 ***
  • Gilles Kohl [MVP]

    #2
    Re: Renaming folder problems

    On Sun, 04 May 2008 05:38:30 -0700, csharpula csharp
    <csharpula@yaho o.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\\my dir" 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 "sourceFold er" and "destFolder " in
    your case? Does "destFolder " already exist?

    Regards,
    Gilles.

    Comment

    Working...