Answers for "check if directory not empty linux script"

1

sh check if directory is empty

#!/bin/bash
DIR="/tmp"

if [ "$(ls -A $DIR)" ]; then
     echo "Wow, $DIR is not Empty"
else
    echo "$DIR is Empty"
fi
Posted by: Guest on June-25-2021

Code answers related to "check if directory not empty linux script"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language