I Need Help Count All Files In Directory

Started on the old forum in August 2007 · view the original in the archive · old links redirect here

2 replies · 629 views · started 19 years ago · 1 min read

Guest #1

i need help count all files(dir+subdir) in directory please... example:

Melodies [3255] Themes [215]

please help me!!!!

ibro9801 #2

From wapbuddy script External image (may be gone)

<?php

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array(); 
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
echo "Files in this directory: $file_count";
?>
Guest #3

From wapbuddy script External image (may be gone)

<?php

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array(); 
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php" and $file != "search.php")
{
$file_array[] = $file;
}
}
$file_count = count ($file_array);
sort ($file_array);
echo "Files in this directory: $file_count";
?>

sory!! this code not count subdirectory

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close