Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Disk Space used by a folder (and sub folders)

by $code or die (Deacon)
on Jan 25, 2001 at 23:52 UTC ( [id://54333]=note: print w/replies, xml ) Need Help??


in reply to Re: Disk Space used by a folder (and sub folders)
in thread Disk Space used by a folder (and sub folders)

That's a very good point! Thanks. I mainly use Win32, and I think that there are a few Win32 modules that will return the block size.

$code or die
Using perl at
The Spiders Web
  • Comment on Re: Re: Disk Space used by a folder (and sub folders)

Replies are listed 'Best First'.
Re: Disk Space used by a folder (and sub folders)
by AltBlue (Chaplain) on Jan 26, 2001 at 23:29 UTC
    hm, doesn't stat function exist on win32? :))
    #!/usr/bin/perl -w use strict; use File::Find; print "Total: ", GetFolderSize( defined $ARGV[0]?$ARGV[0]:'.'), $/; sub GetFolderSize { local $% = 0; find( { wanted => sub { local ($-,$=) = (-s,(stat)[11]); $%+=(int($-/$=)+($-%$=?1:0))*$= }},shift);$% }

    --
    AltBlue.

      Not sure, but I got an illegal divide by zero error when running your example.

      I'll play around with your code and see if I can get it to work.

      $code or die
      Using perl at
      The Spiders Web
        error on getting (stat)[11] could get you a division by zero. i don't have any win32 machines to test this snippet on them, so good luck :)
        on linux and solaris it works ok, outputs exactly the same as du -b. :)
        (one quick solution w'd ofc be an 'and' between those two lines in my subroutine)

        --
        AltBlue.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://54333]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2025-06-16 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.