note 44491 deleted from function.rmdir by tomsommer

From: Date: Sat, 07 Aug 2004 23:45:46 +0000
Subject: note 44491 deleted from function.rmdir by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-74158@lists.php.net to get a copy of this message
Note Submitter: walaces@uol.com.br ---- Another example about recursive delete.... <?php function rm_recursivo($_arq) { if(is_dir($_arq)) { $_d = opendir($_arq); while(($_f = readdir($_d))!==FALSE) { if($_f!='.' && $_f!='..') { if(rm_recursivo("$_arq/$_f")===FALSE) return FALSE; } } closedir($_d); return rmdir($_arq); } else { return unlink($_arq); } } // Example if(rm_recursivo("c:\\TEMP\\TEST")===TRUE) { echo "OK"; } else { echo "ERROR"; } ?>

« previous php.notes (#74158) next »