[TynesideLUG] Counting files in a directory

Ian Bruntlett ian.bruntlett at gmail.com
Sun Feb 2 20:56:26 UTC 2020


Hi,

This is a message for Jimmy, about our conversation at the weekend.

To count the files and folders in a directory, use:-
$ ls -1 | wc -l

To count folders:-
$ ls -d1 */ | wc -l

HTH,


Ian

-- 
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://sites.google.com/site/ianbruntlett/home/free-software


More information about the Tyneside mailing list