Reputation: 32326
The following command will show the disk consumed by each folder.
# du */ -hs
28G Amar/
22G Aurang/
20G Mu/
19G Nag/
13G Nash/
19G Pun/
How do I know the number of files ending with .sql in each folder?
There are no sub-folder if that matters.
Upvotes: 0
Views: 59
Reputation: 824
There are certainly lots of ways to do this. Here is one with a simple approach:
for i in *; do [[ -d $i ]] || continue; echo $i/: $(find "$i" -maxdepth 1 -type f -name '*.sql' | wc -l); done
As you requested, this approach does not take into account the subdirectories.
Upvotes: 1
Reputation: 5972
you shouldn't take it hard....just try it:
ls -l | grep *.sql | wc -l
Upvotes: 0
Reputation: 45662
Try this:
$ find . -type f -name '*.sql*'
./b/a.sql
./b/c.sql
./b/b.sql
./c/a.sql
./c/d.sql
./c/c.sql
./c/b.sql
./a/a.sql
./a/b.sql
$ find . -type f -name '*.sql*' | awk -F/ '{print $2}' | uniq -c
3 b
4 c
2 a
Upvotes: 1