i have made an delete files script which works for only one directory but not sub directory so i want to delete files of same extention from directory and subdirectory
please help i will pay for it
please help i will pay for it
PHP Code:
<?
$dir = 'hmm/';
function scanr($dir){
$arr = glob($dir.'/*.jpg');
foreach($arr as $vv){
//check if $vv is a file
if(is_file($vv)){
//if file, get the filename
$vx=explode('/',$vv);
$file=$vx[count($vx)-1];
// if no extension delete the file
unlink($vv);
// print the deletion message
echo $vv." deleted!<br>";}else{
// if $vv is a dir then scan it again for files
scanr($vv);
}}
}
scanr($dir);
?>
Comment