home

Quickies, by Andrea Olivato

text

Easily count files per subdirectory in bash

#!/bin/sh

for file in *
do
	if [ -d "$file" ]; then
		echo $file ":" `ls $file | wc -l`;
		continue
	fi
done

exit 0

3 years ago

May 14, 2009
Comments (View)
blog comments powered by Disqus