I’m not sure what OS you are on, but on macOs I can hold down alt and click on a directory. This will either close every subfolder in that directory or open them all depending on if it is already open or not. I’m not sure this is what you are looking for? Might be a different key depending on your OS.
To be honest I can’t remember how I found this out. I am on the Sublime Text Discord server which you can join at https://discord.sublimetext.io. There is a lot of helpful conversations that happen there.