Check whether the directory is empty or not
Posted on 2011-02-25
I am writing korn shell script in linux for some task.
As a part of it I want to check whether the directory is empty or not. If the directory is empty I just want to come out of the loop. Otherwise continue processing.
Is it the best way of testing by using find command with emtpy option. What find will return in this case.
while(find /home/user/directory1 -empty -print)
Please suggest me a best solution for this