How do you check if the directory is empty in Unix?

Tâm Tây

New member
How do you check if the directory is empty in Unix?
Answer
There are many ways to find out if a directory is empty or not under Linux and Unix bash shell. You can
use the find command to list only files. In this example, find command will only print file name from /tmp. If there is no output, directory is empty.
 

Tìm kiếm

Back
Top