I'm looking to see if a directory has no files in it or not. I do not want to take folders into account.
Right now I have ls -1ap | grep -v / | wc -l
which will give me the number of files in the directory, but I cant seem to incorporate that into an if statement.
if
ls -1ap | grep -v / | wc -l
< 1; then echo "one"; else echo "two"; fi
Is there anything I can tweak a bit to get this to work? Thank you
Aucun commentaire:
Enregistrer un commentaire