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. General Programming
  3. C / C++ / MFC
  4. Rename a folder?

Rename a folder?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
10 Posts 5 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.
  • A Offline
    A Offline
    Arrin
    wrote on last edited by
    #1

    Hello, is there any other function to rename folder as _wrename(old_name, new_name); Thanks for any help Arrin!

    M N 2 Replies Last reply
    0
    • A Arrin

      Hello, is there any other function to rename folder as _wrename(old_name, new_name); Thanks for any help Arrin!

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      ShFileOperation (or IFileOperation ) is your friend. look at the documentation on MSDN.

      Watched code never compiles.

      A 3 Replies Last reply
      0
      • A Arrin

        Hello, is there any other function to rename folder as _wrename(old_name, new_name); Thanks for any help Arrin!

        N Offline
        N Offline
        Nuri Ismail
        wrote on last edited by
        #3

        An alternative to SHFileOperation is using MoveFile[^] or MoveFileEx[^] APIs. These functions can rename either a file or a directory.

        A 1 Reply Last reply
        0
        • N Nuri Ismail

          An alternative to SHFileOperation is using MoveFile[^] or MoveFileEx[^] APIs. These functions can rename either a file or a directory.

          A Offline
          A Offline
          Arrin
          wrote on last edited by
          #4

          Hi, thanx for answer! Arrin!

          S 1 Reply Last reply
          0
          • M Maximilien

            ShFileOperation (or IFileOperation ) is your friend. look at the documentation on MSDN.

            Watched code never compiles.

            A Offline
            A Offline
            Arrin
            wrote on last edited by
            #5

            Hi, thanx for answer! Arrin!

            1 Reply Last reply
            0
            • A Arrin

              Hi, thanx for answer! Arrin!

              S Offline
              S Offline
              ShadowUz
              wrote on last edited by
              #6

              Try

              MoveFile(LPCTSTR currentNameOfFolder,LPCTSTR newNameOfFolder);

              Example:

              MoveFile(_T("D:\\TestFolder\\RenameMe"),_T("D:\\TestFolder\\MyNewName"));

              1 Reply Last reply
              0
              • M Maximilien

                ShFileOperation (or IFileOperation ) is your friend. look at the documentation on MSDN.

                Watched code never compiles.

                A Offline
                A Offline
                Arrin
                wrote on last edited by
                #7

                Hi, i forgot to say that this is a directory in a LAN? In this case, do i have to do the same, to use same function SHFileOperation for network operations??? When i tray to do this, i receive an error like this "Invalid File path"?? Thanks Arrin

                E 1 Reply Last reply
                0
                • A Arrin

                  Hi, i forgot to say that this is a directory in a LAN? In this case, do i have to do the same, to use same function SHFileOperation for network operations??? When i tray to do this, i receive an error like this "Invalid File path"?? Thanks Arrin

                  E Offline
                  E Offline
                  Emilio Garavaglia
                  wrote on last edited by
                  #8

                  Beware to string escapes: LAN names like \\server\share\dir\file.ext should be "\\\\server\\share\\dir\\file.ext". It is one of the most common errors.

                  2 bugs found. > recompile ... 65534 bugs found. :doh:

                  A 1 Reply Last reply
                  0
                  • E Emilio Garavaglia

                    Beware to string escapes: LAN names like \\server\share\dir\file.ext should be "\\\\server\\share\\dir\\file.ext". It is one of the most common errors.

                    2 bugs found. > recompile ... 65534 bugs found. :doh:

                    A Offline
                    A Offline
                    Arrin
                    wrote on last edited by
                    #9

                    Hi, thanks for answer, is that ah way to resolve a network drive to this LAN name? My Letter is this one P on network, "P:\project\projectname.pf" how to resolve this name to "\\server\project\"??? Is there any solution for this?? I select this folder over an File Dialog, and they give me this path back, but how to convert him to this LAN name! Thanks for any help! Arrin

                    1 Reply Last reply
                    0
                    • M Maximilien

                      ShFileOperation (or IFileOperation ) is your friend. look at the documentation on MSDN.

                      Watched code never compiles.

                      A Offline
                      A Offline
                      Arrin
                      wrote on last edited by
                      #10

                      Hi, when i try to use ShFileOperation i receive a error like "Folder is open by another application"??? My only problem that this dont work on LAN, over LAN! In a local drive its all ok! :( Arrin

                      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