I'm looking for an elegant way to remove all files in a folder that have the extension .jpg

I have the following to count the total jpg files in a folder:

```
Option(new File(path).list).map(_.filter(_.endsWith(".jpg")).size).getOrElse(0)

```

Thanks in advance, any help much appreciated :)