This one time, at band camp,
Kenneth Suralta <[EMAIL PROTECTED]> wrote:
> How do i delete all file in a directory???
bit ugly but...
function del_dir($dirname) {
$dh = opendir($dirname);
while(false !== ($file = readdir($dh)))
{
if($file != '.' && $file != '..')
{
$path = $dirname.'/'.$file;
if(is_dir($path))
{
del_dir($path);
}
else
{
@unlink($path);
}
}
}
if(@rmdir($dirname)==true)
{
echo $dirname.' deleted successfully<br />';
}
else
{
echo 'Unable to delete directory '.$dirname.'<br />';
}
}
if(file_exists($dirname))
{
del_dir($dirname);
}
else
{
echo 'Directory '.$dirname.' does not exist';
}
or something....
Kevin
--
______
(_____ \
_____) ) ____ ____ ____ ____
| ____/ / _ ) / _ | / ___) / _ )
| | ( (/ / ( ( | |( (___ ( (/ /
|_| \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php