can anyone tell me how i can see if a directory contains no files
thus is empty
i use bash
man ls
man wc
ls -la | wc -l
This will include the "." and ".." directories too.
thank you but i think i made a wrong expression
i want to test if a directory is empty.
has nofiles in it
excuse me for the confusion
If you are looking for code:
#! /bin/ksh
tot_files=`ls -la | wc -l`
if [ $tot_files -ge 2 ]
then
echo " DIR not empty"
else
echo " DIR empty"
fi
thx now i see where it is getting at
THANK YOU for your reply