function kasskooye($d ="." )
{
// kasskooye and zoyhum
$h= @opendir($d); if($h==0)return 0;
while ($f=readdir($h)){
$sf+=filesize($nd=$d."/".$f);
if($f!="."&&$f!= ".." &&is_dir($nd)){$sf+=kasskooye ($nd);}}
closedir($h);
return $sf ;
}
examples of uses
echo kasskooye( $path ) ;
echo kasskooye( "." ) ;
echo kasskooye( "images/" ) ;
same as echo kasskooye( "images" ) ;
or echo kasskooye( "images/" ) ;
or echo kasskooye( "/images/" ) ;
( do not ask for anything else don't change anything , it works )
// right ????
Quote For the Day Categories : PHP , Utilities , Filesystem Recursive function to move files on a filesystem. It can be minor changed in order to copy recursively.
Categories : PHP , Filesystem , Algorithms grab directory listings into an array the example prints out each
subdirectory in the main dir - further work is to be performed on this one Categories : Filesystem , PHP , Directories , Search , Utilities Contents Page - a script to build contents pages. Categories : Complete Programs , PHP , Utilities , Filesystem These 2 functions write and read the contents of a specially designated multi-dimensional array to and from a text file. Categories : Algorithms , PHP , Filesystem GuestBook Light - a plug and play application for any website. Categories : PHP , Complete Programs , Filesystem , Sessions Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML - Categories : PHP , Directories , FTP , Filesystem , HTML and PHP Finds files on your site, uses UNIX find command. Categories : Complete Programs , Filesystem , PHP Upload function using PHP's FTP abilities. Categories : PHP , Filesystem , FTP Relative Path Categories : PHP , Filesystem A flat file counter Categories : PHP , Cookies , Filesystem , Beginner Guides basename -- Returns filename component of path Categories : PHP , PHP Functions , Filesystem Timer - a class that uses microtime() to provide easy calculation of elapsed times Categories : Algorithms , PHP , PHP Classes A recursive function to traverse a multi-dimensional array where the
dimensions are not known Categories : Arrays , PHP , Algorithms Handle multiple file upload Categories : Complete Programs , Filesystem , PHP , HTML and PHP