title: How do I check if a folder has contents?
body: <p>I'm trying to create a Bash script that will delete everything in my <code>.waste</code> directory. I have a basic script I wrote but I want it to first check if the <code>.waste</code> directory has contents, and if so, to echo out a simple <code>"Folder already empty!"</code> message. I'm not too savvy about <code>if</code> and <code>if else</code> statements, and I don't know what the <code>[ ]</code> equation needs to check for presence.</p>
  
  <p><strong>Basic code:</strong></p>
  
  <pre><code>#! /bin/bash
  echo "The files have been deleted:"
  cd /home/user/bin/.waste/
  ls
  rm -rf /home/user/bin/.waste/*
  </code></pre>
  
  <p>(P.S. not sure if the asterisk is correct at the end, I did try the script with it and I recall it deleted everything in the <code>bin</code> directory as well)</p>