file counter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Blume

    file counter

    is there a way i can count the number of files in a server side
    directory using php?
    i'm not sure if this sort of thing is possible at all (i'm new to php)
    but would appreciate any tips or scripts anyone could point me to.
    thanks a bunch,
    jb
  • sam

    #2
    Re: file counter

    <?php

    $dir_path = "path/to/your/directory";
    $mydir = dir($dir_path);

    $file_count = 0;
    while($file_nam e = $mydir->read())
    {
    if($file_name!= "." && $file_name!=".. ")
    $file_count++;
    }

    echo "The are $file_count files in the directory $dir_path";

    ?>


    danza4ever@yaho o.com (Jeff Blume) wrote in message news:<313f21ed. 0307030825.3cd0 430d@posting.go ogle.com>...[color=blue]
    > is there a way i can count the number of files in a server side
    > directory using php?
    > i'm not sure if this sort of thing is possible at all (i'm new to php)
    > but would appreciate any tips or scripts anyone could point me to.
    > thanks a bunch,
    > jb[/color]

    Comment

    Working...