Only load resources from ONE folder

To simplify this question let’s say I have only 4 experimental conditions total . Each condition has its own folder in html/resources lets call them ('con1,‘con2’,‘con3’,‘con4’). Within each folder are 80 resources (contains .csvs and images). Based on the participant number (I will use modulo to assign them to one of the four conditions) I want to ONLY load the resources in that condition folder. Is there any way to accomplish this?

I came across these solutions which seem to work well if there are only a few resources needed?

But, because I have so many files in the folders it is not feasible for me to write them all out manually, also each condition folder might be missing some files or have extra files (e.g. ‘con1’ might contain "img_2.png’ but ‘con2’ might not contain ‘img_2.png’.

These are two solutions I think might work but am not sure if they are achievable:
(1) BEFORE loading any resources, is there a way to access all the contents in the condition folders (i.e. a list of strings). This way I can read them all into a dictionary which I will then use to read in only those resources.
(2) All of this could be solved by changing the root path of resources (which is the html folder I think?) to the conditions folder itself. Is this possible?

Thanks!!