Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using Visual studio 2015. Programming unicode characterset & MFC. So I'm using CStrings... ect

I have a very long directory structure where files are located. I need to change the name of one folder within the structure. Example below:

Old name: F:\folder1\folder1\folder3\folder4\backups\JumpList 1\folder A\...files
\folder B\...files

New Name: F:\folder1\folder1\folder3\folder4\backups\JumpList 2\folder\...files

Note 1 : The folder is changing from "JumpList 1" to "JumpList 2". Everything else stays the same. In folder JumpList there are two folders, both containing files.

What I have tried:

I have not tried anything yet for this specific tasks as it is a small part of the entire project, however, my fear is that there is no simple way to do this. That means using CFindFile, FindFirst, FindNext, RemoveDirectory, CreateDirectory .. ect, with a lot of brute force.
Posted
Updated 7-Jan-17 20:26pm

1 solution

I'd look at getting the folder you want as an IShellItem, and using the IFileOperation interface to perform the rename. It will take a bit of reading to get up to speed on getting instances of these interfaces, but it would be well worth the effort due to the flexibility it will grant you in all file operations.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900