Is there a better way to get folders by an specific type of file?

What I mean by the title is to get a list of folders that contain a specific file type, in this case mp3 and m4a.

This is what I’ve done and it works, it does what I want. Problem is that is really slow (and the app crashes) because not only do I get all folders from the device, but get the files from every single one of those folders to see whether or not the folders contain mp3 or m4a files or both. Also, it does it twice to get more than one file type, aka to get mp3 and m4a.

Here is the .aia file (go to screen 2, that’s where the blocks are. Don’t mind screen 1 and 3)
getaudiofolders.aia (88.1 KB)

I will appreciate any help :grin: