View Single Post
  #1   (View Single Post)  
Old 3rd January 2012
sharris sharris is offline
Package Pilot
 
Join Date: Jun 2010
Posts: 146
Default How do we verify if directory is empty?

How do one verify that a directory is empty using an if else statement (script.sh). So far I use:

Code:
rm -rf /temp_1/*
... but if there is hidden files or files that has a format like this (.file) BSD will not delete it.

Code:
if directory_not_empty
do_something
else
continue
How is this done?

Thanks in advance
Reply With Quote