> On Tuesday, Nov 18, 2003, at 09:20 US/Pacific, Dan Muey wrote: > > > Howdy group. > > > > I have a need to get the size of a directory. > > I could just execute unix's du command (my $sz = `du -sh > /usr`;) but > > was wondering if there's a better way to do it that is more > portable. > > I looked on cpan but didn't see anythign that jumped out at me. > > > > a part of the problem is that the 'du' command > is basically implemented differently between the > BSD and SYSV styles of unix. One strategy that > I have adopted when I am looking at a 'common'(HA!) > unix utility that I would like to use, and > in your illustration, the 'flags' to it, that > are problematic, I create a wrapper class. > > a quicky way to think about your problem would > be my WhackJob for dealing with my 'favorite' > set of flags to the 'ps' command: > > cf > <http://www.wetware.com/drieux/CS/Proj/PID/> > > To be honest, I use something like that, but more > cleaned up in a project I have. The trick of > course is getting 'illustrations' from all of the > OS's that you will want to be 'portable' with. >
Thanks. What I really want to do is avoid system commands completely. I could always traverse the directory adding the size of each file together and do that all in Perl with no system commands but I figured there'd already be a Module or something like this, so I want to do it that way. Somthign like: my $sz = $module->size("/home/joemama"); # return sixze of file or of entire directory if specified file is a directory > HTH. > > ciao > drieux -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]