//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
- function to check whether the year given is a leap year or not
- Elgg : The most popular open source social networking platform
- php Questions
- Php Questions
- Php Questions
- php Questions
- errrors in php
- mysql
- Tips on error 'Allowed memory size of xxx bytes exhausted'
- How to find out the Mysql storage engine type of a table.
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.