I'm using this line to get the size of a folder:
set thesize to physical size of folder x
The problem is that sometimes it works, other times it doesn't, and it's very annoying because there doesn't seem to be any kind of logic to it. The same folder path can return "missing value" at first, then return the number of bytes later, without any code change. It seems to start working more often after I "Get Info" on the folder in the Finder, but even that doesn't always work.
How do you make this reliable? I can't send my application to other people with this kind of unpredictability on my own computer.