Quote:
Originally posted by bulliver
Perfect, thanks for your help.
I was thinking I would have to cat the filenames into a temporary file to use wc, just 404ing I guess. Love those pipes.
Thanks again.
|
got to admit that: that may not be what you are exactly seeking
ls -l|wc -l would print total number of files+directories(but not hidden)+1
ls -1|wc -l ditto
ls -la1|wc -l now the hidden files+directories are included but the problem is it outputs the no of files+directories+1(could you find out why this +1?)
ls -1al|grep -e -r -c ;ok now we are going somewhere ; but there are still problems it prints the files +directories number which have
-r in it(all files must have -r-------- at least but directories would have dr????????) the problem with this is that suppose you chmod
707 to a directory it still gets counted;(i know that it is possible with ls and grep to count your files but i will leave it to you; do a little search read man pages and maybe you will get a good one)
now let's try find
find solves all the problems
find . -type f -maxdepth 1|wc -l
it prints the number of all your files in the current directory
now as a side work maybe you could try a perl one liner;
let me give you a hint ; try man 3pm Find::File
and also read
man find2perl
keep posted