Search "end with" instead of extension
<p>I found this script that deletes files from a specific extension from a specific folder i would like to know how can i make it to search files that end with instead of extension lets say "-75x60.jpg" please help me out. tx</p>

<p><strong>File:</strong> file_del.class.php</p>

<pre><code>class fileDel
{

     var $extension;

   /** 
   *   @purpose: Sets path and extension
   *   @params : path, file extension to delete
   *   @return none
   */

   function fileDel($extension)
   {
      $this-&gt;extension = $extension;    
   }//End of function

   /** 
   *   @purpose: Recursively deleting files
   *   @params : path to execute
   *   @return : none
   */

   function delDirFiles ($path)
   {
      $dir = opendir ($path);

      while ($file = readdir ($dir)) 
      {
         if (($file == ".") or ($file == ".."))
         {
            continue;
         }                

             if (filetype ("$path/$file") == "dir")
             {              
            $this-&gt;delDirFiles("$path/$file");
         }                
         //whether file of desired extension is found
                 elseif($this-&gt;findExtension($file)==$this-&gt;extension)
                 {                    
            if(@unlink ("$path/$file"))
            {
               echo "$path/$file &gt;&gt; &lt;b&gt;Deleted&lt;/b&gt;&lt;br&gt;";
            }   
         }                   

      } //End of while
      closedir($dir);

   }//End of function

   /** 
   *   @purpose: Finding extension of a file
   *   @params : filename
   *   @return : extension
   */
   function findExtension($file)
   {

      return array_pop(explode(".",$file));

   }//End of function

} //End of class
</code></pre>

<p><strong>File:</strong> test.php</p>

<pre><code>require_once "file_del.class.php";

$path = "/your/desired/path/to/delete_from";
$ext  = "desired_ext";

$delObj = new fileDel($ext);

$delObj-&gt;delDirFiles($path);
</code></pre>
