Does anyone know how to check if a directory is empty?  I tried the
following:

if [ -d "/dir/to/remove" -a ! -s "/dir/to/remove" ]; then
        echo "Removing /dir/to/remove directory."
        rmdir /dir/to/remove
else
        echo "Directory /dir/to/remove is not empty."
fi

Even if the directory (in this example "remove") is empty (has no other
files or folders) the else statement runs, which means the directory
does not get removed. Any suggestions would be much appreciated.

Thanks,
Jason


--
[EMAIL PROTECTED] mailing list

Reply via email to