As loki said $file() can already do everything you've asked except the size property
With a little help from COM we can mimic all of $file()'s behavior. The follow alias maps everything but the .size property to $file()
If the .size property is specified, it opens a com to the FileSystemObject, retrieves the folder properties, then returns the size property value
alias folder {
var %com = folder, %com2 = prop, %err, %res
if ($prop != size) return $file($1-) [ $+ [ $iif($prop,. $+ $prop) ] ]
if ($isdir($1-)) {
.comopen %com Scripting.FileSystemObject
if ($com(%com) && !$comerr) && ($com(%com, GetFolder, 1, bstr, $noqt($1-), dispatch* %com2) && !$comerr) && ($com(%com2, size, 2) && !$comerr) {
%res = $com(%com2).result
}
}
:error
reseterror
if ($com(%com)) { .comclose $v1 }
if ($com(%com2)) { .comclose $v1 }
return %res
}
Now, with that out of the way, I think $file() should be extended to handle folder sizes aswell
;edited:
Fixed typo in script