You can use the following commands:
find ~/meuDiretorio -not -empty -type d -ls
The above command will list only folders that have some content.
The command find
serves to search folders and files, option -not
means negation, in this case it is to reverse the return of the option -empty
which is to specify empty files or folders, and the option -type
is to specify a type you want, the type set was directories through the option d
passed over to -type
, and she would be like a kind of filter, and finally the option -ls
which 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 if you want.
Sources:
How can I list only non-empty files using ls?: https://superuser.com/questions/191889/how-can-i-list-only-non-empty-files-using-ls
Manual of the find command: http://man7.org/linux/man-pages/man1/find.1.html