Remove directories not empty


Posted on 16th Feb 2014 07:03 pm by admin

hi,
i have an array that contains some names (1,4,6,56...). Every integer is a name of a folder.

I must to delete only the folders in array, i use this code:

Code: $all_folders = array();
while ($row = mysql_fetch_array($result)) {
$all_folders[] = $row['folder_id'];
}

function removedirfiles($all_folders){
$open=readdir($all_folders);
while($files=readdir($open)){
unlink("$all_folders/$files");
}
rmdir($all_folders);
}

removedirfiles("$all_folders");

but it returns those errors:

readdir(): supplied argument is not a valid Directory resource
rmdir(Array) [function.rmdir]: No such file or directory

No comments posted yet

Your Answer:

Login to answer
217 Like 26 Dislike
Previous forums Next forums
Other forums

Sum of Values in an Array
This is probably really simple... but it's been years since I've written anything, so bare with me!<

Sales orders ans reservations not taken into account on MPS / MRP
Hello,

I am implementing the MPS / MRP and I have the following problem:

I ha

Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

unexpected T_SL without a shift left token
Nothing too see here, I'm an idiot and resolved the problem.

Why is this function returning a false value when it shouldn't be??
This is in an include file. I want it to check a value in an html form and see if it's just white s

how can i make a .gif images for my site
Dear Friends ,

Pls solve my problem , I am starting making new site but i dont know how can i

styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.

PHP arrays into arrays need help
Hello
I am trying to highlight the days on my calendar based on the dates that i have in my datab

Wrong Info sent Using $get in form
Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash