note 85710 deleted from function.rmdir by aidan

From: Date: Wed, 15 Apr 2009 04:20:59 +0000
Subject: note 85710 deleted from function.rmdir by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153230@lists.php.net to get a copy of this message
Note Submitter: johan-phpmanual at markupartist dot com ---- Antoher example of deleting a directory that has content, the example uses the spl class DirectoryIterator[1]. <?php $path '/path/to/my/dir'; if (file_exists(dirname($path))) { foreach (new DirectoryIterator(dirname($path)) as $file) { if (true === $file->isFile()) { unlink($file->getPathName()); } } rmdir(dirname($path)); } ?> [1] http://www.php.net/~helly/php/ext/spl/classDirectoryIterator.html

« previous php.notes (#153230) next »