I want to print out all sub-directory names with their content file names below the directory name. If a sub-directory is empty then don't print the directory name and go to the next sub-directory. The applicable part of my code:
for dirs in "$mydir"/*
do
if [ -d "$dirs" -type f" ] && [ "find "$dirs" -type f" ]
then
echo "Processing directory $dirs"
for subfiles in $dirs/*
do
echo "Encoding $subfiles"
done
fi
done
If I leave off the second condition of the first if statement then empty directories will print their name to screen and a * will be listed below that (I guess representing the fact that there's nothing in the directory). The portion after the && doesn't cause any errors, but it isn't preventing empty directories from seeing the rest of this section of the code.
How can I get this to work?