This one works for the most part, but has a subtle problem: Files
with spaces in their names get counted multiple times (because wc -w
counts words instead of lines). Use the "wc -l" form.
On Fri, 15 Sep 2000, Anthony E . Greene wrote:
On 14 Sep 2000 23:26 Adam Sleight wrote:
can't think
On Fri, Sep 15, 2000 at 01:27:37PM -0700, Jim Cunning wrote:
| can't think today...how doe one count the number of files within a
| directory...yes I know du, df, and wc for words in a file.
| ls -a | wc -w
| This one works for the most part, but has a subtle problem: Files
| with spaces in
On Thu, Sep 14, 2000 at 08:26:15PM -0700, Adam Sleight wrote:
can't think today...how doe one count the number of files within a
directory...yes I know du, df, and wc for words in a file.
To count _files_, excluding symlinks and directories:
find . -type f -maxdepth 1 | wc -l
--
ls -1A|wc -l
ls -l directoryname | wc -w
find . -type f -maxdepth 1 | wc -l
ls -1 | wc -l
ls -A | wc
Geez everyone think there was some sort of grand prize or something? Thanks for
the replies...I guess all I needed to know is this..I feel stupid now :-(
ls *.jpg | wc -l
Of course, you can put it in a batch file (filenun, for example), put it
in your path, and use it anywhere...
Bill Ward
-Original Message-
From: Adam Sleight [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 14, 2000 11:26 PM
To: [EMAIL PROTECTED]
Subject: count # files in directory
On 14 Sep 2000 23:26 Adam Sleight wrote:
can't think today...how doe one count the number of files within a
directory...yes I know du, df, and wc for words in a file.
ls -a | wc -w
--
Anthony E. Greene [EMAIL PROTECTED] http://www.pobox.com/~agreene/
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44
can't think today...how doe one count the number of files within a
directory...yes I know du, df, and wc for words in a file.
___
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list
"as" == Adam Sleight [EMAIL PROTECTED] writes:
as can't think today...how doe one count the number of files within a
as directory...yes I know du, df, and wc for words in a file.
How about something simple like:
ls -l directoryname | wc -w
--
Ray Curtis Unix Programmer/Consultant
hello Adam,
you said that you know wc,...
didn't you try
ls | wc
i.e 'ls' piped to wc.
i think it works(atleast for me).
or you try
ls -l | wc
i think you want to count the no of files in a
directory. these will count all the files including
the directories. if you