Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Files in an Directory?

Status
Not open for further replies.

Lazlo71

Programmer
Jul 28, 2001
2
DE
Hi all!

Is there a easy and cool way to count files in a
directory and it's subdirectorys?

I already have 'ls -R1 | wc -l' but i don't think thats
really it. Isn't there a much cooler way to get an int
value that counts the files?

+ It shouldn't be very process intensive,
cause the function is used on a website and
the amount of files is 7000 >= !!!!!!
So 'ls' isn't the best way, is it?!

bye and thanks for help

lazlo
 
hi Lazlo71,

if looking into the php-documentation
(you will find a couple of directory functions
like the followings

chroot -- change the root directory
chdir -- change directory
dir -- directory class
closedir -- close directory handle
getcwd -- gets the current working directory
opendir -- open directory handle
readdir -- read entry from directory handle
rewinddir -- rewind directory handle

and
(shows up a couple of file-related functions which
might be usefull

hope this helps

greetings markus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top