simple list with number of files
simple list with number of files
(OP)
How do you get the number of files within a directory and it's sub-directories in Unix? I'm new to this and have no idea.
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
simple list with number of files
|
RE: simple list with number of files
prompt>ls -lR |grep -v ^'./' |grep -v ^total|grep -v ^d|grep -v ^$|wc -l
This recursively lists the contents of directories, then, using 'grep -v', discards lines starting with './' and 'total' and 'd' and empty lines. The results are piped through 'wc' to get the number of lines remaining.
Oh yeh... this is on Solaris. Maybe slightly different for Linux or HP-UX or other, but probably not.
'hope this helps.