Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

bash test empty directory

#!/bin/bash

DIR="/empty_dir"

# look for empty dir 
if [ "$(ls -A $DIR)" ]; then
     echo "Take action $DIR is not Empty"
else
    echo "$DIR is Empty"
fi
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #test #empty #directory
ADD COMMENT
Topic
Name
7+5 =