cnt=0
if [ ${#excludeArr[@]} -ge 1 ]; then
for el in ${excludeArr[@]}; do
## Recount so we can take specific action on the last element
element_count=${#excludeArr[@]}
# echo FIND COUNT:$element_count
## when the array has only has one element do not use the or switch with prune.
if [ ${#excludeArr[@]} -eq 1 ];then
findArr=( "${findArr[@]}" "-path ${el} -prune" )
else
findArr=( "${findArr[@]}" "-path ${el} -prune -o" )
fi
## remove the most recently used element.
unset excludeArr[$cnt]
## Add one to the count to keep track of the element number were on.
cnt=`echo $cnt |awk '{printf("%02d",$NF+1)}'`
done
## Launch find that excludes directory paths found
echo find ${SRVNAME}/${SID} \\\( ${findArr[@]} \\\) -prune -o -mtime +13 -ls
find ${SRVNAME}/${SID} \\\( ${findArr[@]} \\\) -prune -o -mtime +13 -ls
else
## Nothing to ignore run find
echo find ${SRVNAME}/${SID} -mtime +13 -ls
# find ${SRVNAME}/${SID} -mtime +13 -ls
fi
|