0

I'm looking for a command that will list the number of files across several directories simultaneously. Currently, I can do this for a single directory:

lfs find DIRECTORY -type f | wc -l

But this is tedious to do iteratively. Can someone think of a way to do this more like this answer, but with lfs find, as opposed to gnu find?

Evan
  • 101
  • 4

1 Answers1

0

This command seems to produce the exact same output:

lfs find -type f DIRECTORY | sed -r "s#(.*)/.*#\1#" | sort | uniq -c | sort -k 1 -n

Edit: If you want to group files according to some fixed directory depth:

lfs find -type f DIRECTORY | sed -r "s#((/[^/]*){0,DEPTH})/.*#\1#" | sort | uniq -c | sort -k 1 -n
Evan
  • 101
  • 4