note 76005 added to function.filesize
| From: | RobinLeffmann at osu1 dot php dot net | Date: | Tue, 26 Jun 2007 12:49:14 +0000 |
| Subject: | note 76005 added to function.filesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127986@lists.php.net to get a copy of this message | ||
Here's a dodgy little snippet I made to find out how much disk space (in 1K-blocks) any chosen
node - file or directory - occupies in the file system..
function nodesize( $node )
{
if( !is_readable($node) ) return false;
$blah = exec( "/usr/bin/du -sk $node" );
return substr( $blah, 0, strpos($blah, 9) );
}
The character I search for with strpos() is a tab, as this is what 'du' on OpenBSD uses to
separate size and node in the output - this might be whitespaces in other *nixes/distributions.
----
Server IP: 212.63.193.10
Probable Submitter: 83.227.160.33
----
Manual Page -- http://www.php.net/manual/en/function.filesize.php
Edit -- https://master.php.net/note/edit/76005
Del: integrated -- https://master.php.net/note/delete/76005/integrated
Del: useless -- https://master.php.net/note/delete/76005/useless
Del: bad code -- https://master.php.net/note/delete/76005/bad+code
Del: spam -- https://master.php.net/note/delete/76005/spam
Del: non-english -- https://master.php.net/note/delete/76005/non-english
Del: in docs -- https://master.php.net/note/delete/76005/in+docs
Del: other reasons-- https://master.php.net/note/delete/76005
Reject -- https://master.php.net/note/reject/76005
Search -- https://master.php.net/manage/user-notes.php