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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. renaming a directory?

renaming a directory?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
4 Posts 3 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.
  • W Offline
    W Offline
    will1383
    wrote on last edited by
    #1

    Hi all, I'm trying to programmatically rename directories. Anyone know how to do this in MFC? I'm looking around, and I don't see an easy, quick, straight forward method. Any help is greatly appreciated. I know I need to get the normal path and such, but how the heck do you rename it without axing the stuff in the directory? Thanks! Dan Willis

    P G 2 Replies Last reply
    0
    • W will1383

      Hi all, I'm trying to programmatically rename directories. Anyone know how to do this in MFC? I'm looking around, and I don't see an easy, quick, straight forward method. Any help is greatly appreciated. I know I need to get the normal path and such, but how the heck do you rename it without axing the stuff in the directory? Thanks! Dan Willis

      P Offline
      P Offline
      pete mcquain
      wrote on last edited by
      #2

      All you should have to do is use ::MoveFileEx(OldFolderName, NewFolderName, 0). There's nothing built into MFC that I'm aware of to do this. This doesn't kill the contents of the folder. It would probably be safest to use absolute paths for each paramter. If something in the folder is in use, you can specify a flag for the 3rd param to wait until reboot. -pete

      1 Reply Last reply
      0
      • W will1383

        Hi all, I'm trying to programmatically rename directories. Anyone know how to do this in MFC? I'm looking around, and I don't see an easy, quick, straight forward method. Any help is greatly appreciated. I know I need to get the normal path and such, but how the heck do you rename it without axing the stuff in the directory? Thanks! Dan Willis

        G Offline
        G Offline
        gradiov
        wrote on last edited by
        #3

        If I am not mistaken then you should be able to get away with MoveFile, MoveFileEx or MoveFileWithProgress. Good Luck.

        W 1 Reply Last reply
        0
        • G gradiov

          If I am not mistaken then you should be able to get away with MoveFile, MoveFileEx or MoveFileWithProgress. Good Luck.

          W Offline
          W Offline
          will1383
          wrote on last edited by
          #4

          Thanks Guys, About 30 seconds after I posted this I found the MoveFile, MoveFileEx and good 'ole rename. works like a charm now :) thanks! Alot!!! Wahoo! Dan Willis

          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