note 93669 added to function.glob

From: Date: Tue, 22 Sep 2009 13:00:51 +0000
Subject: note 93669 added to function.glob
Groups: php.notes 
Request: Send a blank email to php-notes+get-160920@lists.php.net to get a copy of this message
A function to quickly remove a directory (works in seconds for a hundred thousand files) <?php /** * Remove the directory and its content (all files and subdirectories). * @param string $dir the directory name */ function rmrf($dir) { foreach (glob($dir) as $file) { if (is_dir($file)) { rmrf("$file/*"); rmdir($file); } else { unlink($file); } } } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 194.78.5.130 ---- Manual Page -- http://www.php.net/manual/en/function.glob.php Edit -- https://master.php.net/note/edit/93669 Del: integrated -- https://master.php.net/note/delete/93669/integrated Del: useless -- https://master.php.net/note/delete/93669/useless Del: bad code -- https://master.php.net/note/delete/93669/bad+code Del: spam -- https://master.php.net/note/delete/93669/spam Del: non-english -- https://master.php.net/note/delete/93669/non-english Del: in docs -- https://master.php.net/note/delete/93669/in+docs Del: other reasons-- https://master.php.net/note/delete/93669 Reject -- https://master.php.net/note/reject/93669 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160920) next »