//This function is for sub directories size (This will retrn an array )
function du($location) {
if (!$location || !is_dir($location))
return 0;
$size = 0;
$files = 0;
$dirs = 0;
$all = opendir($location);
while ($file = readdir($all)) {
if (is_dir($location.'\\'.$file) and $file != ".." and $file != ".") {
$temp = du($location.'/'.$file);
$dirs++;
$size += $temp['size'];
$files += $temp['files'];
$dirs += $temp['dirs'];
unset($temp);
unset($file);
} elseif (!is_dir($location.'\\'.$file)) {
$stats = stat($location.'\\'.$file);
$size += $stats['size'];
$files++;
unset($file);
}
}
closedir($all);
unset($all);
return array('size' => $size, 'files' => $files, 'dirs' => $dirs);
}
[Friday, January 11, 2008
|
0
comments
]
Popular Posts
- php questions
- some php questions
- How to create a plugin in elgg.
- php Questions
- Mysql query for searching a value, add weightage on the number of occurances and sort based on the weight-age
- Contact Me
- solving the packaging problem in PHP
- How to add or remove WWW on URLs using htaccess.
- php questions
- Inserting nodes into xml files using XML DOM in PHP .
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.