From 118c6a9e7846ae828036e6eae9d217d0cdd1e4f0 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 5 Mar 2013 16:07:14 -0500 Subject: [PATCH] fixed to make a nicer output and to not show the directory one's in. --- scripts/files/count_files_in_subdirs.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/files/count_files_in_subdirs.sh b/scripts/files/count_files_in_subdirs.sh index d54ee6e8..7814ca01 100644 --- a/scripts/files/count_files_in_subdirs.sh +++ b/scripts/files/count_files_in_subdirs.sh @@ -1,7 +1,9 @@ #!/bin/bash -dirs=$* -if [ -z "$dirs" ]; then dirs=*; fi -for i in $dirs; do - ls -1 $i | wc | sed -e "s/^ *\([0-9]*\) *.*$/$i: \1/" +dirs=($*) +if [ -z "$dirs" ]; then dirs=($(find . -mindepth 1 -maxdepth 1 -type d ) ); fi +#echo dirs are ${dirs[*]} +for i in "${dirs[@]}"; do + echo -n $(ls -1 $i | wc -l) + echo -e "\t\t$i" done -- 2.34.1