presso Posted March 13, 2007 Share Posted March 13, 2007 I have this snippet of code which is what i am sort of after but after alot of trying different things i have been able to get it do do what i want. Currently this bit of code will return the amount of dirs , files and current size of all files combined that is sent in $path , what i would like to be able to do is the same thing but it also includes all the child dirs and files with the $path dir , could somebody point me in the right direction for this if at all possible. $path="set path here"; $totalsize = 0; $totalcount = 0; $dircount = 0; if ($handle = opendir ($path)) { while (false !== ($file = readdir($handle))) { $nextpath = $path . '/' . $file; if ($file != '.' && $file != '..' && !is_link ($nextpath)) { if (is_dir ($nextpath)) { $dircount++; $result = ($nextpath); $totalsize += $result['size']; $totalcount += $result['count']; $dircount += $result['dircount']; } elseif (is_file ($nextpath)) { $totalsize += filesize ($nextpath); $totalcount++; } } } } closedir ($handle); Link to comment https://forums.phpfreaks.com/topic/42457-how-to-modify-this-code-to-reflect-child-dirs/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.