Michael
Michael

Reputation: 321

How to count specific folders under UNIX

i would like to ask you, if there is any way to count specific folders in my directory. it looks like this:

mydir/ 2004..2013/ jan...dec/ 01.01.04...31.1.04/ 10000 . . . 20000 . .99999

so its like: year/month/day-in-month/serial nr. folder/

What I need is to count all folders with serial nrs but in two groups: 1. count all serial nrs starting with "1" 2. count all other serial numbers

I am not very familiar with UNIX, so i will appreciate if someone can help me.

Thx, in advance.

Upvotes: 0

Views: 40

Answers (1)

JPG
JPG

Reputation: 2264

Try find . -mindepth 4 -type "d" -name "1*" | wc -l from mydir; and then find . -mindepth 4 -type "d" -name "[2-9]*" | wc -l

Upvotes: 2

Related Questions