I am trying to print all directories and sub directories with a recursive function but I get only the first directory. Any help?

counter(){
list=`ls $1`
if [ -z "$(ls $1)" ]
then
exit 0
fi
echo $list
for file in $list
do
if [ -d $file ]
then
echo $file
counter ./$file
fi
done
}
counter $1