note 83576 deleted from function.rmdir by aidan

From: Date: Wed, 15 Apr 2009 04:21:18 +0000
Subject: note 83576 deleted from function.rmdir by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153232@lists.php.net to get a copy of this message
Note Submitter: hoffmeister ---- A simple method <?php $path="./folder/folder_to_delete/"; $handle = opendir($path) for (;false !== ($file = readdir($handle));) if($file != "." && $file != "..") unlink($path.$file); closedir($handle); rmdir($section); ?> or with error checking <?php $path="./folder/folder_to_delete/"; if ($handle = opendir($path)) { for (;false !== ($file = readdir($handle));) { if($file != "." && $file != "..") { if(unlink($path.$file)) $info.="file ".$file." delete sussfully<BR>"; else $info.="Unable to delete file ".$file."<BR>"; } } closedir($handle); if(!rmdir($section)) $info.="<BR>Could not delete directory ".$path; else $info.='<BR>'.$path.' deleted'; } else $info.="problrm deleting directory"; ?>

« previous php.notes (#153232) next »