Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by www.cyberciti.biz #
 
PREVIOUS NEXT
Tagged: #sh #check #directory #empty
ADD COMMENT
Topic
Name
9+1 =