Answers for "how to check if directory is 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
1

directory is not empty windows

// On windows
C:>rmdir /S nonemptydir
Posted by: Guest on June-01-2021

Code answers related to "how to check if directory is empty"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language