![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read list of filenames from text file and remove these files in multiple directories | fxvisions | Shell Programming and Scripting | 5 | 08-07-2008 04:59 PM |
| how to list directories only | yodadbl07 | UNIX for Dummies Questions & Answers | 3 | 04-26-2006 05:48 AM |
| How to list only directories? | videsh77 | UNIX for Dummies Questions & Answers | 4 | 01-09-2006 10:10 AM |
| List directories | malaymaru | UNIX for Dummies Questions & Answers | 3 | 09-25-2005 10:54 AM |
| List specific files from directories | Filippo | Shell Programming and Scripting | 4 | 02-17-2005 03:56 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
I want to count how many levels there are under a directory. I repeat level.
Also how i count only all the files in a directoy ( all files of all directories of all leves down!) and how can i count only all the directories under a directory (including subdirectories, all levels down) Please someone help me!!! |
|
||||
|
To count all the files,
Code:
find dir -type f|wc -l Code:
dir=path/to/some_directory
m=0
for path in `find $dir -type d`
do
n=`echo $path|sed s,$dir/,,|awk -F / '{print NF}'`
[ $n -gt $m ] && m=$n
done
echo $m
|
![]() |
| Bookmarks |
| Tags |
| find |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|