Re: question about # of files in a directory
- From: japhy@xxxxxxxxxxxx (Jeff 'japhy' Pinyan)
- Date: Fri, 30 Sep 2005 10:09:57 -0400 (EDT)
On Sep 28, ZHAO, BING said:
Is there a way to call or maybe get the # of files in a directory?
The simplest way is to use opendir() and readdir().
opendir my($dh), $path or die "can't opendir $path: $!"; my @files = readdir $dh; closedir $dh;
Now you have the files from the directory $path in the array @files. The number of elements is the number of files.
-- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://www.perlmonks.org/ % have long ago been overpaid? http://princeton.pm.org/ % -- Meister Eckhart .
- References:
- question about # of files in a directory
- From: Bing Zhao
- question about # of files in a directory
- Prev by Date: Re: Comparing an array with hash keys
- Next by Date: RE: a little help...
- Previous by thread: Re: question about # of files in a directory
- Next by thread: Current directory?
- Index(es):
Relevant Pages
|
|