Jump to content

Delete folder and its contents


Woodburn2006

Recommended Posts

$filespath="folder/*"; //path of files to be deleted

$folder="folder"; //path of folder to be deleted

 

foreach (glob($filepath) as $filename)

{

  unlink($filename);

}

 

rmdir($folder);

 

Will this only work if the $folder path doesn't contain any directories?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.