Size with AS vs Size displayed in Finder: Why different?
Size with AS vs Size displayed in Finder: Why different?
- Subject: Size with AS vs Size displayed in Finder: Why different?
- From: Mr Tea <email@hidden>
- Date: Thu, 07 Feb 2002 19:10:58 +0000
Even on a speedy G4, the Finder takes a while to display the sizes of well
packed folders when 'calculate folder sizes' is checked in list view
options. (OS 9.2.2/AS 1.8.2bx)
The script I knocked up to give me this information more quickly (by writing
it into each folder/file's comments field) seems to work OK, but the sizes
it returns are different to those displayed by the Finder. Who should I
believe.
These are the kind of discrepancies I'm seeing:
Finder AppleScript
770 MB 766.58 MB
361.3 MB 353.85 MB
331.8 MB 330.16 MB
112.2 MB 112.25 MB
588 K 593.04 K
(Sizes of folders over 1 GB, also to two decimal places, came out the same,
I suspect because the differences were not great enough to trouble the
significant figures).In most cases, the AS-calculated size was smaller. I
thought I began to see a pattern of greater discrepancies in the figures for
folders with numerous small files - which suggested that AS is totting up
the actual size of the contents, leaving out the unused section of any
partially used blocks (am I warm). But then why were some AS figures
actually higher than the Finder9s calculations?
Here9s the script. As always, any suggestions for tweaks or improvements are
more than welcome.
tell application "Finder" to set theItems to every item of alias "Studio!:"
as alias list
repeat with anItem in theItems
copy (size of (info for anItem)) / 1.073741824E+9 to theGBs
if theGBs < 1 then
set theMBs to theGBs * 1024
if theMBs < 1 then
set theKBs to theMBs * 1024
set theComment to text 1 thru ((offset of "." in theKBs as
string) + 2) of (theKBs as string) & " KB"
else
set theComment to text 1 thru ((offset of "." in theMBs as
string) + 2) of (theMBs as string) & " MB"
end if
else
set theComment to text 1 thru ((offset of "." in theGBs as string) +
2) of (theGBs as string) & " GB"
end if
tell application "Finder" to set comment of anItem to theComment
end repeat
Mr Tea
--
"Always remember to warm the pot."
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.