In my working directory, I have a number of subfolders:
SNPsplit_HS_10k_thrs3
SNPsplit_HS_1k_thrs3
SNPsplit_HS_5k_thrs3
SNPsplit_slidingwindow_1000_thrs3
SNPsplit_slidingwindow_100_thrs3
SNPsplit_slidingwindow_2500_thrs3
SNPsplit_slidingwindow_250_thrs3
SNPsplit_slidingwindow_5000_thrs3
SNPsplit_slidingwindow_500_thrs3
I want to know how many files are in each of these directories. If I use something basic like ls -1 SNPsplit_HS_* | wc -l, ls will show the contents of all the SNPsplit_HS_ subdirectories, and then give me the number of lines of that output. I would rather like to see something similar to
SNPsplit_HS_10k_thrs3: 1700
SNPsplit_HS_1k_thrs3: 4200
SNPsplit_HS_5k_thrs3: 2600
Do I need ot use a loop here? Also, is there a way to filter dir/file/symlink? If I wanted to look at *.vcf files in each directory, how would I go about?
find. – Ljm Dullaart Jan 13 '23 at 18:29ls -1you used does not work recursively. "Recursive" may mean the number you want to get forSNPsplit_HS_10k_thrs3is the total count of files in this directory and its subdirectories, deeper and deeper, as deep as it takes. Or "recursive" may mean you want a line of output forSNPsplit_HS_10k_thrs3and a separate line of output forSNPsplit_HS_10k_thrs3/dirA,SNPsplit_HS_10k_thrs3/dirBand so on. Please [edit] and clarify. – Kamil Maciorowski Jan 14 '23 at 20:57