Press SHIFT key to expand all - I think everyone knows this;
Now, this is the messed up part - While all folders are expanded (by using the SHIFT key above), press CTRL + SHIFT to collapse the current folder, then while still holding CTRL, release SHIFT, then click to expand the current folder - you will discover all folders are folded.
I discovered this while I was frustrated by having to manually click and expand everything. Hope it helps!