Well, I began trying to explain this in detail but then my system crashed and I lost my post so you get the abbreviated version
A volume is not (or at least, doesn’t seem to be) just another folder. FYI, when you run ‘info for’ against a volume, it seems to always return size:missing value. You can just ask for ‘size’ however.
tell application "Finder"
set xy to selection
--> {startup disk of application "Finder"}
set xy to selection as alias
--> alias "Macint:"
set fi to info for of xy
set sz to size of xy
--> 4.77264175104E+11
end tell
When I open Get Info on my startup disk, it doesn’t display a size immediately. And when it does, it continues to change slowly for a while, presumably becoming incrementally more accurate as it has more time to weigh things. Likewise, when I get the size using a script, the result isn’t final. If I wait a bit and run the script again, I get a different size. This doesn’t really happen for regular folders. I assume that it’s related to stuff like metadata and symbolic links but I don’t really know.
I ran the script and it returned the following:
[format]–> 4.77396119552E+11[/format]
After typing another sentence, I ran it again and it returned this:
[format]–> 4.77396586496E+11[/format]
Just so you’re aware, applescript won’t display integers with values of 2^29 or higher, as is. It displays those using scientific notation. That means 536870911 is the highest integer that gets displayed this way. So, if you want to use these in a table, you need to mess around with them a bit:
tell application "Finder"
set xy to selection as alias
set sz to size of xy as text
--> "4.77263044608E+11"
character 1 of sz & (characters 3 thru 13 of sz)
--> "477263044608"
end tell
On the subject of handling multiple selected folders, this should actually work. As implied above, I would be suspicious about using it on multiple volumes.
tell application "Finder"
set folSel to selection as alias list
set nmList to {}
set szeList to {}
set sziList to {}
repeat with ef in folSel
set end of szeList to size of ef
-- convert sizes to integer/text
if size of ef is greater than 2 ^ 29 then
set sze to size of ef as text
tell me to set end of sziList to character 1 of sze & (characters 3 thru ((offset of "E" in sze) - 1) of sze)
else
set end of sziList to size of ef
end if
set end of nmList to name of ef
end repeat
-- combine properties into tab-separated values
set tsv to ""
repeat with xx from 1 to count of nmList
set tsv to tsv & item xx of nmList & tab & item xx of sziList & linefeed
end repeat
end tell
tsv