Name

info for

Synopsis

file/folder information

file/folder information

Gets information about an item on disk. Returns a file information record packed with useful stuff. If you ask for the info for a folder, the script may take some time to run, in order to sum the sizes of all the files within it; you can prevent this by saying without size.

Example

set uf to (path to home folder as string)
set L to list folder uf
set s to {}
repeat with f in L -- collect sizes of all items
    set end of s to size of (info for file (uf & f))
end repeat
set maxItem to 0
set maxVal to 0
repeat with i from 1 to (count s) -- find biggest size
    if item i of s > maxVal then
        set maxItem to i
        set maxVal to item i of s
    end if
end repeat
display dialog "The biggest thing in your home folder is: " & item maxItem of L

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.