How to find out if a directory is empty by the terminal?

6

I uploaded some files, via ftp, to put my application into production.

For some error in the application, I noticed that some files were missing. When I gave a ls I realized that some folders were empty, but I can not enter one by one to check.

How to list empty grazing in Linux ? Is there any way to do this through the terminal?

    
asked by anonymous 17.03.2016 / 13:07

1 answer

5

You can use find to find empty folders, see below:

find . -type d -empty

The . indicates that the search will be performed from the folder where the command is executed.

While the type -d indicates that the output will be done only by directories (folders).

Finally, -empty indicates that the search will be done by empty directories.

    
17.03.2016 / 13:46