?
Solved

Counting Files

Posted on 2003-02-24
2
Medium Priority
?
244 Views
Last Modified: 2006-11-17
Is there any way to count the amount of files in one folder (eg = myfiles/counting) and return the number as a variable? (eg = $file_number)

~thanks everyone!
0
Comment
Question by:momonja
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
VGR earned 180 total points
ID: 8011453
sure

  $d = dir("yourdirectory"); // like ./hereandthere
  $i=0;
  while($entry=$d->read()) {
    if (($entry<>'.') and ($entry<>'..')) $i++;
  } // while
  $d->close();

// your number of files is in $i
0
 

Author Comment

by:momonja
ID: 8011631
Thanks so much!!!
0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question