Why do I have to run this twice?

Hi All,

I made this little script just to check on how full some sharepoints are. I have to run it twice to get a current value, it seems to cache it (maybe?). Can anyone tell me why that is?

Thanks!


tell application "Finder" of machine "eppc://<myserver>"
	set SizeOf to (size of folder "<share1>")
	set SizeOf1 to (size of folder "<share2>")
	set CapOf to (capacity of disk "<share1>")
	set CapOf1 to (capacity of disk "<share2>")
end tell

set folSize to convertByteSize from SizeOf
set folSize1 to convertByteSize from SizeOf1
set volSize to convertByteSize from CapOf
set volSize1 to convertByteSize from CapOf1

display dialog "Share 1 is at " & folSize & " of " & volSize & "
" & "Share 2 is at " & folSize1 & " of " & volSize1

to convertByteSize from byteSize
	if byteSize is greater than or equal to 1.099511627776E+12 then -- Terabytes (2 ^ 40) 
		((byteSize / 1.099511627776E+12 div 0.01 / 100.0) as string) & " TB"
	else if byteSize is greater than or equal to 1.073741824E+9 then -- Gigabytes (2 ^ 30) 
		((byteSize / 1.073741824E+9 div 0.01 / 100.0) as string) & " GB"
	else if byteSize is greater than or equal to 1048576 then -- Megabytes (2 ^ 20) 
		((byteSize / 1048576 div 0.01 / 100.0) as string) & " MB"
	else if byteSize is greater than or equal to 1024 then -- Kilobytes (2 ^ 10) 
		((byteSize div 1024) as string) & " K"
	else
		(byteSize as string) & " bytes"
	end if
end convertByteSize

I got no idea but maybe this would be a different way to do it but you will have to mount the shares first

display dialog (do shell script "df  -h | awk '{OFS=\"   \"} /(Volumes|Size)/{print $2,$3 ,$4,$5,$6}'")