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

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

PHP/PKI
I am trying to set up a web application that uses pki. does anyone have a good tutorial to set this

BI in Upstream Production operations
Appreciate if you can assist in the following areas:
1) Examples of life before and after BI i

Encrypt php code?
Is it possible to encrypt php code in files,
so that it displays a load of unreadable characters

disabling a button server-side then re-enabling client-side breaks button postback
I have a tabbed container and a button (not in the container) on a page. If the first tab is selecte

Retreiving objects from Sessions
Hi all,

I am getting really frustrated with storing and retreiving objects from a session. Bu

chat
hello i'm amir i need a chat source code in asp.net 2.0 without Ajax. anybody can help me?

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

Java API in PHP?
I have an application that we use internally here at the office.

The software company provide

Something like an INI editor or a DelimitedText-Editor
Hi all,

Am very, very, very new to PHP and not sure if I should be posting this to a Javascri

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