You can use the following commands:
find ~/meuDiretorio -not -empty -type d -ls
The above command will only list the folders that have some content.
The find
command is for searching folders and files, the -not
option means deny, in this case it is to invert the return of the -empty
option which is to specify empty files or folders, and the option -type
is to specify a type you want, the type defined was directories through the d
option passed to -type
, and it would be as a filter type, and finally the -ls
option that is responsible for getting some more information , and in this context it is an option of the command find
, you can remove it if you want to see only non-empty directories.
The character ~
indicates your home folder, example /home/usuario
, you can change it if you want.
Sources:
How can I list only non-empty files using ls ?: link
Find command manual: link