Hi
I want to delete all .html files in current directory using php code?
any solution?
thanks a lot.
how can i delete all files in a folder
Moderator: General Moderators
I would do something like this:
Code: Select all
$dir_handle = @opendir('path') or die('Cannot read the path.');
while ($file = readdir($dir_handle))
{
if(is_file($file) and strpos($file,'.html'))
{
unlink($file);
}
}
closedir($dir_handle);