View Single Post
Old 09-03-2009, 08:26 AM  
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by quantum-x View Post
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;  } 
?>

thanks man.
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote