shopt -s nullglob
+shopt -s extglob
# if we make a link back to the root, traversing the subdirs stops.
# This makes it so we can do subdir directories. Must call with absolute
local root="$1"
local targets=()
if [[ $2 ]]; then
- targets=( "$2"/* )
+ targets=( "$2"/!(.git) )
else
- for f in "$1"/*; do
+ for f in "$1"/!(.git); do
[[ -d $f ]] && targets+=("$f") ||:
done
fi