[thelist] PHP Questions
Steve Webster
steve at netbreed.co.uk
Mon Sep 30 07:55:01 CDT 2002
Steve Webster wrote:
> Tony Crockford wrote:
> [snip]
>
>> Q2,
>>
>> Anyone got any tips, tutorials or code snippets that would allow me to
>> automatically delete *.htm files from all sub-directories off a given
>> directory?
>>
>>
> You want a recursive function to search through all directories from a
> base directory and remove all files that match a cartain pattern. Kinda
> like this...
As an afterthought, the function I gave you will also try and remove the
directories. If you want to keep the directory structure intact, change
this...
if (is_dir($cDirectory . $file)) {
deleteFiles($filter, $cDirectory . $file);
}
...to this...
if (is_dir($cDirectory . $file)) {
deleteFiles($filter, $cDirectory . $file);
continue;
}
Regards,
Steve
More information about the thelist
mailing list