note 101652 deleted from function.rmdir by danbrown

From: Date: Sun, 02 Jan 2011 15:52:43 +0000
Subject: note 101652 deleted from function.rmdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175395@lists.php.net to get a copy of this message
Note Submitter: tra_neo ---- remove directory and all sub's and files. the two items commented is for show the item and the sub-directory deleted, os if you want see what is remove.. uncomment those two lines. function remove_dir($path) { if (is_dir($path)) { $dir = scandir($path); foreach($dir as $file) { if ($file != '.' and $file != '..') { if (is_dir($path.$file)) { remove_dir($path.$file.'/'); rmdir($path.$file); //echo "$path.$file\n<br>"; } else { unlink($path.$file); //echo "$path.$file\n<br>"; } } } } }

« previous php.notes (#175395) next »