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

Display last record first.
I need some help how put the last record first and first record last.

Thanks

Code: &am

JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w

PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.

How would I exac

Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page']

ereg_replace()
Basically what i need to do is

$title = "This Suck's"

$striped = ereg_repl

Using Curl_multi for processing multiple URLs
Hi,

I am at a loss as to how to implement this. I would like to be able to automatically assi

Include a php
Hello,

I'm trying to include a function that shows the recent searches.
Example I have <

Locking mysql tables with php
Hi

BACKGROUND:
I have multiple instances of the same php script running in a WAMP environ

post to self
Trying to get my form to submit to itself. However I am also trying to use an image for my submit bu

Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to a

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