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

Re: [MacPerl] Determining free disk space



At 10:34 AM +0200 10/11/99, Ian wrote:
>Hi
>
>I've had a look at CPAN, the FAQ, and searched the mailing list archive, but
>with no joy. I'd like to write a simple script that runs as a cron job and
>checks the space remaining on all the volumes on our server...if there's
>less than a certain amount of space on one of the volumes it'll email the
>sysadmin with the details.
>
>However, I can't find a way of finding out how much free space there is on a
>mounted (or local) volume. There are a couple of Unix modules for this, but
>evidently not for the Mac. Any clues?
>

Well.  This sounds like a job for glue...
use strict;
use Mac::Glue ':all';
my $finder = new Mac::Glue 'Finder';

my $freespace = $finder->get($finder->prop('free_space',disk => 'Jeff-HD'));

print "$freespace\n";
__END__

But I'm not getting quite the result I'm looking for.  It sends the same AE
as the corresponding AppleScript (another option)
tell application "Finder"
   get free space of disk "Jeff-HD"
end tell

but I get a result like
comp(«0000000017402000»)

So I don't think I'm coercing things right or using the right terminology
somewhere.

It might be easier/faster to just use the AppleScript?

-Jeff Lowrey



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org