This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Cookie Policy.
FAQ

We provide webhosting for thousands of domains.
Transfer your domains to us and join our satisfied customers.

Domains from 5,99€. Renewal for the same price.

Support

FAQ

Others

HOTLINE  
+421 221 028 430
E-MAIL support
support@exohosting.com
ICQ support
213 057 503
ONLINE support

Mo-Fr: 08:00-20:00
Sa-Su: 10:00-18:00

Economy

Mo-Fr: 08:00-16:30

Free transfer of .sk domain

If you transfer your domain to us, we pay transfer fee for you.

How to recursively delete a directory?

seen: 1394 | Date added: 05.09.2010 | rating:
"

To delete your files recursively, use this function:

function SureRemoveDir($dir) {
if(!$dh = @opendir($dir)) return;
while (($obj = readdir($dh))) {
if($obj=='.' || $obj=='..') continue;
if (!@unlink($dir.'/'.$obj)) {
SureRemoveDir($dir.'/'.$obj);
} else {
$file_deleted++;
}
}
if (@rmdir($dir)) $dir_deleted++;
}

The function deletes files created using php by deleting files writeable for the group. To use this function, make sure you have safe_mode turned off in your PHP settings.

Another safer option is to change file/directory attributes created by php and then you can delete them via FTP.

"
Was this article helpful?
no
Hodnotenie 2.7/5 (578 hlasov)
yes

Related topics