0

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.

0

3 Answers 3

1

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 
Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

@FredrikPihl thanks for enlightening me. I've modified my answer to keep its essence, but I've now taken into account your comment.
0

you shouldn't take it hard....just try it:

ls -l | grep *.sql | wc -l 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.