View Single Post
Old 09-03-2009, 08:03 AM  
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
This will do the trick.

PHP Code:
<?
foreach(globr('/path/to/dirname/','*pix*') as $v) unlink($v);
function globr($sDir, $sPattern, $nFlags = NULL) { 
  $sDir = escapeshellcmd($sDir); 
  $aFiles = glob("$sDir/$sPattern", $nFlags); 
  foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) 
  { 
    $aSubFiles = globr($sSubDir, $sPattern, $nFlags); 
   $aFiles = array_merge($aFiles, $aSubFiles); 
  } 
  return $aFiles;  } 
?>
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote