• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File size


  • Subject: Re: File size
  • From: Andy Wylie <email@hidden>
  • Date: Sat, 04 May 2002 09:28:47 +1200

on 4/5/02 2:00 AM +1200: Peter Mathiessen wrote:

> Hi all,
>
> Anyone how knows how to get the size (MB) of a file from the finder?
>
on Chew(Chomp)
set {bytes, cnt} to {{"bytes", "kB", "mB", "gB", "tB", "pB", "eB"}, 0}
repeat until Chomp < 1024
set {Chomp, cnt} to {Chomp / 1024, cnt + 1}
end repeat
tell Chomp to return ((it div 1) + (it mod 1) * 100 div 1 * 0.01) &
bytes's item (cnt + 1) as string
end Chew

tell application "Finder" to set |size| to largest free block
Chew(|size|)
-- "37.89mB"
_____________________________ Andy
_______________________________________________
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.

  • Follow-Ups:
    • Re: File size
      • From: Christopher Nebel <email@hidden>
References: 
 >File size (From: Peter Mathiessen <email@hidden>)

  • Prev by Date: Re: TIDs Tabs & Square Brackets (Script Debugger question)
  • Next by Date: Re: offset with spaces confusion
  • Previous by thread: Re: File size
  • Next by thread: Re: File size
  • Index(es):
    • Date
    • Thread