From cbd7ef41cfa6b9edf590e16093a8a03bf9a451d6 Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 31 Aug 2017 20:10:37 +0200 Subject: [PATCH] Fix handling depth --- diriterator.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diriterator.sh b/diriterator.sh index 79b168b..4bd3cf7 100755 --- a/diriterator.sh +++ b/diriterator.sh @@ -15,13 +15,13 @@ function queueexec { } function iteratedirs { local dir="$1" - local depth="$2" + local currentlevel="$2" local current_rel_dir="$3" for item in "$dir"/*; do if [[ -d $item ]]; then if [[ $depth == none ]] || [[ $currentlevel -lt $depth ]]; then - iteratedirs "${item}" $(($depth + 1)) "${current_rel_dir}${item##*/}/" + iteratedirs "${item}" $(($currentlevel + 1)) "${current_rel_dir}${item##*/}/" fi elif [[ -f $item ]]; then if [[ ! $filter ]] || [[ $item =~ $filter ]]; then