note 115598 added to function.rmdir

From: Date: Fri, 22 Aug 2014 12:41:52 +0000
Subject: note 115598 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-200288@lists.php.net to get a copy of this message
This function sorely needs a built-in option to delete the contents of the directory. Or another function that does exactly that - deletes a path (file or folder, doesn't matter). It is still much simpler to just use something like the following to delete any directory rather than write some 10+ line function that has corner cases that will break it: <?php if (PHP_OS === 'Windows') { exec("rd /s /q {$path}"); } else { exec("rm -rf {$path}"); } ?> Most webservers are run on 2 or 3 different popular operating systems, so this would easily work for almost all websites. ---- Server IP: 72.52.91.14 Probable Submitter: 86.63.161.34 ---- Manual Page -- http://php.net/manual/en/function.rmdir.php Edit -- https://master.php.net/note/edit/115598 Del: integrated -- https://master.php.net/note/delete/115598/integrated Del: useless -- https://master.php.net/note/delete/115598/useless Del: bad code -- https://master.php.net/note/delete/115598/bad+code Del: spam -- https://master.php.net/note/delete/115598/spam Del: non-english -- https://master.php.net/note/delete/115598/non-english Del: in docs -- https://master.php.net/note/delete/115598/in+docs Del: other reasons-- https://master.php.net/note/delete/115598 Reject -- https://master.php.net/note/reject/115598 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200288) next »