Say you have a list of .wav files in a particular directory tree, and say you have another pile of .phr files that may or may not be in the same directory tree. The .phr files contain in text the names one or more .wav files. And you need to rename a bunch of the .wav files and have the associated change reflected in any relevant .phr file. How might you choose to set things up to do this "scripted" file renaming?
At present, I'm thinking that it might be done as follows:
- Recurse the directory (tree) for .wav files and store the filenames in the first in a vector of pair of string.
- Modify the filename in a temp after the first and store as the second.
- Perform the renaming/copy-w-mod now or later.
- Recurse the directory (tree) for .phr files and store the filenames in a vector of string.
- Loop through the vector of .phr filenamse, open each, and search each line for an instance of the filename text.
- On match, replace text (via rewrite on-the-fly or whatever).
- Lather, rinse, repeat as necessary.
Another way I was thinking of doing it was to copy the .wav to both members of the pair on the read and then later transform the second.