delete dir and contents

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dsjoes
Forum Commoner
Posts: 41
Joined: Thu May 20, 2010 3:15 pm

delete dir and contents

Post by dsjoes »

how do i get this to delete subfolders and its files aswell

Code: Select all

$mydir = $path.$file; 
$d = dir($mydir); 
while($entry = $d->read()) { 
 if ($entry!= "." && $entry!= "..") { 
 unlink($mydir."/".$entry); 

 }  
} 
$d->close(); 
rmdir($mydir);
dsjoes
Forum Commoner
Posts: 41
Joined: Thu May 20, 2010 3:15 pm

Re: delete dir and contents

Post by dsjoes »

anyone
Post Reply