I am at the directory:
/home/john/my_test_files/
and under the directory there are 100 folders:
folder1
folder2
folder3
...
folder100
what command would I use to print the list of folders and the each one's file count side by side. Something like this:
folder1 25
folder2 78
folder3 34
...
folder100 88
where folder1
has 25 files in it, folder2
has 78 files in it, etc
I'm sure this is something basic but I couldn't find a good answer…
Best Answer
Here is one relatively slow solution, that provides a nice output :) Place the following function at the bottom of your
~/.bashrc
file. Then open new terminal window or do source the run commands file:. ~/.bashrc
.Then use the
count_in
function as shell command:Sample output: