Running through filesystem directories programatically

I have been struggling to find a solution for an Igor analysis I need to do.

My experimental data are fluorescence spectra that need to be integrated
(through the area function). The data are organized as follows;

1) a root directory within the filesystem whose name is a date string
2) Within this root multiple folders named after the sample measured
3) Within each sample folder exactly four ASCII files containing x-y data representing the fluorescence spectra. Each of these four curves needs to be integrated in a certain range and the four values need to be combined into one datapoint (being the fluorescence anisotropy value). The files that need to be processed each time are *VVA.*, *VHA*.*, *HHA.*, *HVA.*

I would like to point igor to the root directory (the one of a certain date) after which it would have to automatically cycle through all subdirectories present, processing the files in each subfolder. However I do not seem to be able how to achieve this. All I can have it do at the moment is point it to an actual subfolder and process the 4 files in this folder, however, what I would like to do is have it output something like;

Date: Sample1 -> calculated anisotropy value
Date: Sample2 -> calculated anisotropy value
Date: Sample3 -> calculated anisotropy value
...

An example of the input data is attached to this post. The files that need to be processed each time are *VVA.txt, *VHA*.txt, *HHA.txt, *HVA.txt

This would be the result of experimental data in the paths of form C:\Date\Sample*\(four files here)

Is it possible to have Igor run through all subdirectories of a certain
path in the filesystem?

My current code looks like this;
Function CalcAnisotropy(Duplication,Start,Stop,NameWave,WaveCondition,Appendix)
    Variable Duplication
    Variable Start
    Variable Stop
   
    String NameWave
    String WaveCondition
    String Appendix
   
    prompt Duplication, "Keep original wave (1) or overwrite (0):"
    prompt Start, "Start integration at (nm):"
    prompt Stop, "Stop integration at (nm):"
    prompt NameWave, "Select source wave", popup, Wavelist("*", ";", "")
    prompt WaveCondition, "Give match condition for wavename (empty in case of single wave):"
    prompt Appendix, "Appendix for new wave in case of keeping original wave:"
    doprompt "Input parameters", duplication, start, stop, namewave, wavecondition, appendix
    if (V_flag == 1)
        Print "Cancelled by user..."
        return -1
    endif
    variable HH
    variable HV
    variable VH
    variable VV
    variable R
    string wn2
    string wl
    wl= wavelist(Wavecondition, ";","")
   
    NameWave = stringfromlist(0,wl,";")
    Printf NameWave + ": "
    HH = area($NameWave,Start,Stop)
    Print HH
   
    NameWave = stringfromlist(1,wl,";")
    Printf NameWave + ": "
    HV = area($NameWave,Start,Stop)
    Print HV
   
    NameWave = stringfromlist(2,wl,";")
    Printf NameWave + ": "
    VH = area($NameWave,Start,Stop)
    Print VH
   
    NameWave = stringfromlist(3,wl,";")
    Printf NameWave + ": "
    VV = area($NameWave,Start,Stop)
    Print VV
   
    Printf "Anisotropy: "
    R = ((VV*HH)/(HV*VH)-1)/((VV*HH)/(HV*VH)+2)
    Print R
   
end
<\igor>
250608.zip
KrisJ: You might take a look at the IndexedFile() function and the GetFileFolderInfo operation. Between the two of those, I believe you should be able to accomplish what you wish.
See the help for the IndexedDir function. It includes an example of recursively traversing directories.