while [ $COUNT -lt $DIRNUM ]
use numerical comparison operators -lt, -eq, -ne and so on, since the = < <= are for string comparison.
if [ $STATUS -eq 0 ]
the "if $STATUS" construct without square brackets, tries to evaluate the expression as a command and returns its exit status. Also take in mind that in bash you cannot use
to return true or false respectively. A single argument without relational operators, is treated as a string and the result of the test is always true.