Answers for "linux script to check if directory is not empty"

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 "linux script to check if directory is not empty"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language