Hi, anyone have any korn shell script that do a recursive files count from parent directory and below?
example: /etc/ls -l|wc -l
/etc/rc2.d/ls -l|wc -l
/etc/rc2.d/a/ls -l |wc -l
Thanks

use find: # untested
find dir1 dir2 -type f -print|wc -l
thanks, the find command sum up all the directories files within the dir1.
I looking for something that can count and list individual directory files recursively.
Wanted to know numbers of files kept in the directories and not knowing how many child directories are there within a parent directory.
The find command can look at more than one directory at a time. Sorry, but I'm not understanding your problem
I'm actually wanted to count the number of files in each of the directory. Let's say dir1 contain sub-directories /dir1/dir1a and /dir/dri1b, the result will be something like these:
/dir1 - 333 files
/dir1/dir1a - 500 files
/dir1/dir1b - 666 filesappreciated.
egls
Ok, I understand. You want to serch just the current directory and none of the child driectories below. The GNU version of find (read Linux) has a maxdepth option. Since you're on Solaris, you probably don't have it. You need a script that does the same, so check out this URL:
http://www.unixreview.com/documents/s=8925/ur0310e/ur0310e.htm
This article covers a few miscellaneous tips. The one you are interested in is:
A Method for Executing find on Files in the Current Working Directory
