ahoffman: find total files

Go on then, I'll bite:

What SHOULD I have suggested to bsher to find the "total files in a directory"? ls -la shows all files, (plus . & .. & the total blocks line), so ls -la |grep "^-" |wc -l counts the ordinary files.

Or am I still missing something?
LVL 21
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

depending on you ls, you may have fun with this:

   touch 'a\^Jb'

(where ^J is ESC followed by return)

BTW, FreeBSD's ls automatically handles such things as one line, but not SunOS, Solaris, HP-UX, IRIX, and most Linux

(not really a question, so I'm not afraid that the question will be deleted, after we got some more comments ;-)
tfewsterAuthor Commented:
Touche - I made a couple of assumptions in my answer to bsher 1) that it was a simple query & 2) I didn't consider odd filenames, [although I've seen problems in the past with filenames with control characters in them].

"An assumption is the first step towards a foul-up"

I stand corrected & the points are yours, unless someone else has a more amusing example of how directories  can get messed up.

well, just assume that your UNIX/Linux runs Samba, and what the stupid clients may create as file- or directory names ;-))
(in german we may call it: DAUs,  which I won't translate to prevent some flames:-)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.