Hello, I'm Nathan, I'm a 3D Animation student and know very basic C++, but haven't touched it in a good 6 years.

Here's my problem: I have data from some video footage I shot, and the data is in 3 folders: An Audio Folder, a Video Folder, and a XML Folder which links each Audio File to a Video File. The problem is the Camera was totally random at naming the files and I need to rename them.

So, I need to write a program that will read a folder and sequentially read the xml file, rename a string within that file, rename that file, and rename a corresponding file in a different folder.

This is what I figure the program needs to do:

1) Read the first xml file in the given folder
2) Replace a string within the xml file ( simply changing "file name: jumbled-numbers" to "file name: shot##")
3) Rename the xml file (again from "jumbled-numbers" to "shot##")
4) Rename the file with the name "jumbled-numbers" in each Audio and Video folder to "shot##"
5) Do it iteratively.

So the only thing I don't know how to do is (1)read different directories, (2)rename files, (3)replace a string in a read file, and (4) make it iterative. I just don't know the commands. I can write the rest of code.

This is kind of unusual, but if you could help me out, that'd be awesome.

Okay, so here's a skeleton:

// Rudimentary Renaming Protocol for XML files, hope this works.

#include <fstream>
#include <iostream>
using namespace std;

void main()
{
	//declarations
	char Rename [15];
	
	//read xml file

	//print what file has read
	//cout << "File is *whatever*";
	
	//query what it should be renamed
	cout << "Rename to: ";
	cin >> Rename;
	
	//change 5th line in xml file from <ClipName>*whatever*</ClipName> to <ClipName>Rename</ClipName>
	
	//change U:/aLot/of/directories/Video/*whatever*.mxf
	//to 	U:/aLot/of/directories/Video/Rename.mxf
	
	//change U:/aLot/of/directories/Audio/*whatever*.mxf
	//to 	U:/aLot/of/directories/Audio/Rename.mxf
}

For reading files in a folder, I've seen several options, including "ifstream" and "FindFirstFile." Which one is more appropriate?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.