stopped allowing ampersands in file names, added documentation lines.
[feisty_meow.git] / scripts / files / count_files_in_subdirs.sh
index d54ee6e82e66a1baacbb49e4c297fe71c89a9d21..7814ca01bc4ca538124cced01c20ed6174293621 100644 (file)
@@ -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