INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

file count in directory and sub-directories

file count in directory and sub-directories

(OP)
I have two commands with different counts on the same directory.
directory /u1/oracle

CODE

find . -name '*' | wc -l
   69355 

CODE

find . -type f -print | wc -l
   64008 

I am assuming the first command includes hiden files and the second does not. Am I correct in my assumption or not.
How would I know what is the true count on the directory?

RE: file count in directory and sub-directories

Hi

Compare the lists generated by those two commands to see what differs :

CODE

diff <( find . -name '*' ) <( find . -type f -print ) 
( You will need a shell supporting process substitution for the above command, for example Bash or Zsh. If none available, use temporary files instead. )

For example :

CODE --> command line

master # touch .one two; mkdir three

master # ls -l 
total 0
drwxr-xr-x 2 master master 48 May 27 11:11 three/
-rw-r--r-- 1 master master  0 May 27 11:11 two

master # find . -name '*'
.
./two
./.one
./three

master # find . -type f -print
./two
./.one

master # diff <( find . -name '*' ) <( find . -type f -print )
1d0
< .
4d2
< ./three 

As you can see, the hidden file is included in both lists, but the directories not.

Feherke.
feherke.github.io

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close