Yasirkula releases this script - you can right click in the project or hierarchy and choose collapse folders. I just tried it today. Super simple and works great, after years of me going by hand and closing folder after folder