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

Asked

Viewed 787 times

6

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

Due to some error occurred in the application, I realized that some files were missing. When I gave a ls I realized that some folders were empty, but I can’t get into one by one to check.

How to list empty pastures on Linux ? Is there any way to do it through the terminal?

  • 3

    Try that

1 answer

5


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

find . -type d -empty

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

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.