I'm writing a program and part of it involves reading from files in certain folders in order to combine them into single files. The top level folder is C:\\PROGRAMS\\.
So for example one folder in this directory would generally look something like:
C:\\PROGRAMS\\AAA-999a
which contains the files...
\\AAA-999a_Test1.txt
\\AAA-999a_Test2.txt
These two .txt files are combined into a single .txt file in the same folder, AAA-999a.txt.
I already have the code that does this if the user gives the string that matches the folder name; in this case AAA-999a.
However, the PROGRAMS\\ directory contains many of these folders and I want to be able to make a call that runs through every folder in the directory beginning with AAA, BBB or CCC and uses the code I described above on them (folders can be added or removed any time, and can have a different -999a part of their name, but will always begin with AAA, BBB or CCC).
I guess my problem is I don't really know where to start. Any code, pseudocode, or just an idea of how to get started on this would be great.
Thanks!
EDIT:
I should add that these files are combined with a file in the top level directory named Common.txt. Common.txt has flags in its code that are used to determine when to start reading the test files. So the first part of Common.txt is read until it finds //--Test1 Start--// then reads in the Test1 file. It will then continue reading from Common.txt until //--Test2 Start--// is found. Then the rest of Common.txt is read in.