CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Reading Space Of A Directory

 



perlkid
stranger

Aug 26, 2000, 8:14 PM

Post #1 of 3 (271 views)
Reading Space Of A Directory Can't Post

 
I've made a script that allows people to store files in their own directory, now how can I read the size of the directory?

Thanks,

perlkid


Kanji
User

Aug 26, 2000, 9:48 PM

Post #2 of 3 (271 views)
Re: Reading Space Of A Directory [In reply to] Can't Post

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

$size = -s $directory;</pre><HR></BLOCKQUOTE>
... but I'm not sure how useful that's going to be as you probably want to know the size of the directory and its contents, right? Smile

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

#!/usr/bin/perl -l

use File::Find;

my $size = 0;

find( \&size_of, @ARGV );

sub size_of {
$size += -s $File::Find::name;
}</pre><HR></BLOCKQUOTE>


perlkid
stranger

Aug 26, 2000, 11:16 PM

Post #3 of 3 (271 views)
Re: Reading Space Of A Directory [In reply to] Can't Post

 
Thanks Kanji,

I'm Using The first one and It works great. Thanks a lot.

perlkid

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives