note 58585 deleted from function.filesize by aidan

From: Date: Wed, 09 Nov 2005 06:12:51 +0000
Subject: note 58585 deleted from function.filesize by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98289@lists.php.net to get a copy of this message
Note Submitter: cory at lavacube dot com Reason: useless ---- Oopsie! I made a mistake. I realized that, in my stupidity, I used grep to locate "total". grep will produce a list of all files containing the word "total". Here is my fix, and a "human readable" addition. <?php function du( $dir='./', $human_read=false ) { // human readable? $h = ($human_read?'h':null); // ensure path is a directory if( !is_dir($dir) ) { return 0; } // build command $cmd = 'du -s' .$h. ' "' .$dir. '"'; // run command $temp = explode("\t", exec($cmd)); $dirsize = trim($temp[0]); // output result return $dirsize; } ?>

« previous php.notes (#98289) next »