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
tree -d path/to/locationorfind /path/to/location -type d. Also, please don't post screenshots of text; just put the code into your question. Also also, don't parsels. Just usefor file in /path/to/location/*.