• 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: Determing the Size of a File
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determing the Size of a File


  • Subject: Re: Determing the Size of a File
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 2 May 2001 18:36:01 -0700

On 5/2/01 4:46 PM, Scott Earleywine <email@hidden> wrote:

>Is there a way to make this a droplet?
>
>I pasted the code, but when I run it...the file I had selected (obviously)
>deselects and the script 'checks' the compiled script's size.

This script will give you the size of each file or folder dragged onto
the droplet. (Be careful of dropping folders; it can take a very long
time to calculate the size of large folders.)

--Michelle

on open (itemList)
repeat with testItem in itemList
set {isfolder, fileSize, itemName} to {folder, size, name} of (info for
testItem)

if isfolder then
set itemKind to "folder "
else
set itemKind to "file "
end if

set the units to "bytes"
if fileSize is greater than 1024 then
set the fileSize to my roundit(fileSize / 1024)
set the units to " kilobytes"
end if
if the fileSize is greater than 1024 then
set the fileSize to my roundit(fileSize / 1024)
set units to " megabytes"
end if
display dialog "The " & itemKind & itemName & " is " & fileSize & space
& units
end repeat
end open

to roundit(inputsize)
return (round inputsize * 10) / 10
end roundit

----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------


  • Follow-Ups:
    • Re: Determing the Size of a File
      • From: David Blache <email@hidden>
  • Prev by Date: Re: Determing the Size of a File
  • Next by Date: Re: Script Editor odd behaviour
  • Previous by thread: Re: Determing the Size of a File
  • Next by thread: Re: Determing the Size of a File
  • Index(es):
    • Date
    • Thread