For files:
find directory/ -type f | wc -l
For directories:
find -mindepth 1 -type d | wc -l
Reference :
-mindepth levels
Do not apply any tests or actions at levels less than levels (a non-negative integer). -mindepth 1 means process all files except the starting-points.
-type c
File is of type c:
- b block (buffered) special
- c character (unbuffered) special
- d directory
- p named pipe (FIFO)
- f regular file
- l symbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use -xtype.
- s socket
- D door (Solaris)
- -l, --lines
Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success
0 nhận xét:
Post a Comment