Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Question about deleting files

$
0
0

Hey,

 

I know I have posted question several posts about this topic, Im just having a little but of a difficulty deleting a directory and the files at the same time. Below is the code I wrote, that deletes all the files, and the directory at the same time. I even double check the directory to make sure the files are not there, and they aren't.

 

But for some reason when I execute this code, all the files get deleted but the directory doesn't get deleted. PHP also gives me the following error message

Warning: rmdir(php_files2) [function.rmdir]: Directory not empty in /Applications/XAMPP/xamppfiles/htdocs/sandbox/delete_all_files.php on line 3

 

Below is my code. Any suggestions on how to fix this?

$dir = "php_files2";
$array_map = array_map("unlink",glob("$dir"."/*.*"));
rmdir($dir);

Viewing all articles
Browse latest Browse all 13200