Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to rename a folder using asp.net

How to rename a folder using asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelptutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khan Bangash
    wrote on last edited by
    #1

    Hi All I have created a folder which I want to rename through coding. If some knows the procedure then pls help me. thanks in Advance.

    G S I 3 Replies Last reply
    0
    • K Khan Bangash

      Hi All I have created a folder which I want to rename through coding. If some knows the procedure then pls help me. thanks in Advance.

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use the System.IO.Directory.Move or the System.IO.DirectoryInfo.MoveTo method.

      --- single minded; short sighted; long gone;

      1 Reply Last reply
      0
      • K Khan Bangash

        Hi All I have created a folder which I want to rename through coding. If some knows the procedure then pls help me. thanks in Advance.

        S Offline
        S Offline
        Sandeep Kumar
        wrote on last edited by
        #3

        Hi, I think the possible way to rename the folder is to delete the folder and create the new folder with the new name, before deleting the old folder we should move he contents of that folder to new folder.

        Regards, Sandeep Kumar.V

        1 Reply Last reply
        0
        • K Khan Bangash

          Hi All I have created a folder which I want to rename through coding. If some knows the procedure then pls help me. thanks in Advance.

          I Offline
          I Offline
          Imran Khan Pathan
          wrote on last edited by
          #4

          System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(Server.MapPath("1")); if (dInfo.Exists) { System.IO.Directory.Move(Server.MapPath("1"), Server.MapPath("2")); } I just tried it.Its working fine Here "1" is folder name Best Regard Khan

          ---------------------------------------------------

          K 1 Reply Last reply
          0
          • I Imran Khan Pathan

            System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(Server.MapPath("1")); if (dInfo.Exists) { System.IO.Directory.Move(Server.MapPath("1"), Server.MapPath("2")); } I just tried it.Its working fine Here "1" is folder name Best Regard Khan

            ---------------------------------------------------

            K Offline
            K Offline
            Khan Bangash
            wrote on last edited by
            #5

            Thank u all of u, its realy helpfull. I have done my work. Once again thanks

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups