|
You know a map would be a really good container to use to accomplish that function. If you store the names of the file within a file and change the names there first, you are not going to know the original file names to change. You will need to maintain a file which keeps the file name maps.
Ultimately you could just use a map class in C++ and maintain the map of all files, store the full directory of the file (relative to your listing point) to prevent map collisions, and the map value will be the name you want to change the file to.
Iterate through your map and make the changes you want, popping values off your map (or erasing them since I do not think you can pop from a map) as you rename each of your files. Store results into a file or on the stdout if you want.
Using IR's rename code is probably the most robust means, if you do not need robust remember you can always use system( "mv orginal_filename new_filename" )--if you do that remember to use full diretories in your map key and value.
|