title: How to delete json files in a folder using php
body: <p>I need to delete only json files which existing in a particular folder using php. am trying this code</p>
  
  <pre><code>$path = "uploads/File Name/";
  $files = scandir($path);
  foreach ($files as $csv_file) {
    $filepath = str_replace(" ", "\ ", $csv_file);
    echo $filepath . '&lt;br/&gt;';
    unlink($csv_file);
  }
  </code></pre>
  
  <p>but when am using this its deleting all the file. I need to delete only json files</p>