//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
- Elgg : The most popular open source social networking platform
- function to check whether the year given is a leap year or not
- Contact Me
- some php questions
- php questions
- Help with codeignitor
- Function to find out last 12 months details from the current date
- creating dynamic elements in HTML using Javascript.
- php Questions
- Creating Custom Module in VtigerCRM
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.