hey guys,
i was wondering if there's a bash script to check the amount of files in a directory with an IF statement..
like:
IF directory has less than 100 files
(executes command)
ELSE
Done
Thanks in advance guys!!
I know this is to check if directory is empty:
Code:
#!/bin/bash
DIR="/tmp"
# init
# look for empty dir
if [ "$(ls -A $DIR)" ]; then
echo "Take action $DIR is not Empty"
else
echo "$DIR is Empty"
fi
# rest of the logic
But how to check if a directory has less than 100 files