To check if a folder is empty of not, you can use
if [ "$(ls -A /home/boby/1/ )" ] then echo "Files found" else echo 'No files found' fi
If you want to reverse the checking, you can use !
if [ ! "$(ls -A /home/boby/1/ )" ] then echo "No files found" else echo 'Files found.' fi
See bash
Leave a Reply