Link to home
Start Free TrialLog in
Avatar of JimIntriglia
JimIntriglia

asked on

How to determine number of files in a partition?

When I got my new RH V6.0 Linux PC, the first thing I did was run my backup software, BRU2000 personal edition.

When BRU completed, it reported that 500 files were written to tape. How can I ensure (via either text-based command or GNOME/KDE GUI, how may files are contained in all of the folders in all of the partitions?

I want to cross-check that BRU really did backup all files.

Avatar of JimIntriglia
JimIntriglia

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of crouchet
crouchet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, if you do not have tree installed then do this:
cd /
ls -AR | wc -l

The | is a pipe (just above the \ on the keyboard) and the -l is a lower case L as in lucky.

Your hard disk will run like mad and then a number will appear. It will not be 500.

Hey, I do card tricks too!

J Crouchet
Avatar of ozo
df -i
Thanks for your response. The Tree command gave me the info that I needed; it reported 4591 directories with 79935 files.

The ls -AR | wc -l was pretty cool too, but I think you meant to use the -c switch on the wc (count bytes instead of newlines).

Also, ls -AR | wc -c returns 1,163,652 bytes (a little over 1MB), which is too low a byte count for all directories and files. I don't know what this number represents.

I don't think the ls -R recursion is happening (the hint is that I get a byte count within 5 seconds).

Any idea why this does not work? It should.. your syntax/pipe construct makes sense.
Hey.. that's goofy.. I assigned 25 points to this question, not 2 (!).  

Crouchet, do you know how I can transfer the additional 23 point to your experts account?

Having accepted an answer, this is now a Previously Asked Question, which can be bought for 10% of the original value.
25 points * 4 for an A grade = 100 points would have been awarded to crouchet@lc
From the EE Help Page:

"When you accept an expert's answer, the question points you offered are deducted from your account. The expert's score is then increased by the number of points you offered for the question, multiplied by the grade you assigned to the answer. "

So ozo, If my original point valuation (25pts) had stuck (instead of the 2pts displayed) 25pts would have been deducted from my account and crouchet would have received and addition 75pts from EE for my A grade, for a total of 100 pts.

BTW - thanks for your response as well (I missed that short post of yours) - it did not answer my question, but provided useful information that I was not aware of. Thanks ;-)
Er, yeah, I got my points, no sweat. Thanks.

However, if you ever DO need to send points to a specific person just pose a question with their name on it (i.e. a title like "Points for CROUCHET") . Instead of a question put in something like this:
These are points I owe Crouchet. I will only accept his answer.

Then if anyone else proposes an answer, reject it. Only accept the answer from the person who you want to give points.

BTW, the wc -l gives you a count of lines, which IS what you want in this case. When you pipe the output  of ls to wc it sends one filename per line. The only flaw is that it also sends one line per directory name. Thus if you have 79935 files and 4591 directories then doing:
ls -AR | wc -l
from the root directory (/ not /root) should give you a result of about 84526. Still, this is close enough to tell you that 500 was not right.

Of course, tree is a better way to do this, which is why I always install it when setting up Linux.

J Crouchet
Thanks.