@scnils
Does the following code work for you?
My code is not so elegant as the code by @jamshark70,
but it seems to work well at least on my end:
(
~buffers = Dictionary[];
~pathBase = Platform.resourceDir;
PathName(~pathBase).filesDo { |item|
var
folder = item.folderName.asSymbol,
path = item.fullPath;
if ("aiff|aif|wav|flac".matchRegexp(item.extension)) {
if(~buffers.at(folder).isNil) {
~buffers.put(folder, []);
("The dictionary key \\" ++ folder + "is added to ~buffers").postln
};
~buffers[folder] = ~buffers.at(folder).add(Buffer.read(s, path));
("The added file to the key \\" ++ folder + "is" + item.fileName).postln;
}
}
)
Post <<< ~buffers
~buffers[\sounds]
~buffers[\sounds].size
~buffers[\sounds][0].play
~buffers[\sounds][1].play
~buffers[\sounds][2].play
If the subfolders of your main sound folder are only one level deep, the following code might be applicable even though there is no dictionary: