[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Folder Size?




} At 15:40 96-01-04, Scott Weaver wrote:
} 
} >How do I get the real size (bytes used as given by Info) of a folder?
} 
} Same as you would in any OS -- recurse the directory subtree and add it
} all up. (You may have noticed the Finder doing the same when you do a
} "Get Info" on a folder.)
} 
} To get the size of the resource fork, use an XCMD or XFCN to give this.

This may be one of those times when simply asking the Finder may be the best choice:

$folder = "Macintosh HD:Applications:";
$size = MacPerl::DoAppleScript(<<ENDIT);
tell application "Finder"
size of alias "$folder"
end tell
ENDIT
print "$size\n";

This gets both forks of every file in the folder in one swoop.  If you
have lots of them to size, though, then maybe an XCMD or XFCN will give
you a speed advantage over AppleScript.

} 
} --Hal
} Hal Wine <hal@dtor.com>     voice: 510/482-0597
} 
} 
} 
---
--------
Paul J. Schinder
NASA Goddard Space Flight Center,
Code 693, Greenbelt, MD 20771 USA
schinder@pjstoaster.pg.md.us