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:
Did you know?Explore Trending and Topic pages for more stories like this.

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

True way to see if action was successful?
If this is a good way to see if action was successful to continue:

Code: function changeGa

RadioButtonList item spacing
I have a RadioButtonList and I can't put any spacing between the items. They are arranged verticall

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

Query issues
I probably have this setup wrong well I know I do because nothing is showing up now. What I want is

disable all input buttons
Hello Friends,

suppose i do have a file ( file.php ) has a submit button

Code: [Sele

Rounding a number queried from a database
I know that to display a rounded number you just do echo "round($number)";. But how would

On page view, minus credit
Hello all, please, I need a little help with this script. I am charging one credit (credits can be p

highlighting search terms
well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm

Taxonomy? Classification? Categorisation?
Not sure if there is a way around this classification problem
I have a supplier who produces

Storing user data help?
Hey Guys,

I'm not use if this question is to broad but I can always give you more informatio

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