AvgFileSize column script - can't get folder size

This is what I had in mind, and gives you complete control or what is/isn't counted as well as the option of full recursion or not, with a single, simple loop:

var FolderPath = "C:\\"
var IsRecursive = false;

var TotalSize = DOpus.FSUtil.NewFileSize();
var TotalFiles = 0;
var FolderEnum = DOpus.FSUtil.ReadDir(FolderPath, IsRecursive);
while (!FolderEnum.complete) {
	var FolderItem = FolderEnum.next;
	if (!FolderItem.is_dir) {
		TotalSize.Add( FolderItem.Size );
		TotalFiles++;
	}
}
DOpus.Output(TotalFiles + " files, " + TotalSize + " bytes");