Re: Determing the Size of a File
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. |
----------------------------------------------------------------------