title: Scala - Remove files from folder by file suffix name
body: <p>I'm looking for an elegant way to remove all files in a folder that have the extension .jpg</p>
  
  <p>I have the following to count the total jpg files in a folder:</p>
  
  <pre><code>Option(new File(path).list).map(_.filter(_.endsWith(".jpg")).size).getOrElse(0)
  </code></pre>
  
  <p>Thanks in advance, any help much appreciated :)</p>