title: Scala - delete file if exist, the Scala way
body: <p>How to nicely delete file in Scala, "the Scala way"? </p>
  
  <p>For example, i can use something like this, very <em>Java</em> style:</p>
  
  <pre><code>  private def deleteFile(path: String) = {
      val fileTemp = new File(path)
      if (fileTemp.exists) {
         fileTemp.delete()
      }
    }
  </code></pre>
  
  <p>How would it be implemented in Scala, in a more functional syntax?</p>