title: How to clear directory contents in c++ on Linux (basically, i want to do 'rm -rf <directorypath>/*'
body: <p>I am writing a c++ program on Linux (Ubuntu). I would like to delete the contents of a directory. It can be loose files or sub-directories.</p>
  
  <p>Essentially, i would like to do something equivalent to </p>
  
  <pre><code>rm -rf &lt;path-to-directory&gt;/*
  </code></pre>
  
  <p>Can  you suggest the best way of doing this in c++ along with the required headers.
  Is it possible to do this with sys/stat.h or sys/types.h or sys/dir.h ?!</p>