You could probably http://php.net/exec some kind of shell script to do it.

Or, something not unlike this:

# Untested code:
function count_files($directory){
    static $count;
    if (!isset($count)){
        $count = 0;
    }
    $dir = opendir($directory);
    while ($path = readdir($dir)){
        if ($path != '.' && $path != '..'){
            if (is_dir($path)){
                count_files($path);
            }
            else{
                $count++;
            }
        }
    }
    closedir($dir);
}

If you want to count directories, copy the $count++ up a couple lines.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Sagar N Chand <[EMAIL PROTECTED]>
Newsgroups: php.general
To: php <[EMAIL PROTECTED]>
Sent: Tuesday, September 25, 2001 7:49 AM
Subject: no of files in a folder....


hi all,

is there any way out to get the total no of files in a directory including
its
subfolders ?

thanQ,,

/sagar




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to