Calculating folder sizes in a script

This page in the Opus manual explains that got_size is a Boolean based on whether or not a folders size has been calculated. It gives the example of the GetSizes command. I see GetSizes is a Directory Opus Internal Command. Is this a good way to get the sizes of folders to calculate first in a script? Thanks

These two posts should have all you need:

Related, counting files instead of sizes:

Super helpful. Thanks so much!