This snippet should return the # of files in the directory the script is running in. You could modify it accordingly.
$num_of_files = 0;
if( $handle = opendir( '.' ) ){
while( false !== ( $file = readdir( $handle ) ) ){
if( $file != "." && $file != ".." ){
$num_of_files++;
}
}
closedir( $handle );
}
Or if you wanted to list the files at some point:
if( $handle = opendir( '.' ) ){
while( false !== ( $file = readdir( $handle ) ) ){
if( $file != "." && $file != ".." ){
if( !isset( $files ) ){
$files = array(1 => $file );
} else {
$files[] = $file;
}
}
}
closedir( $handle );
}
$num_of_files = count( $files );
Just guesses - not tested, nor am I accountable for syntax :quiet: