note 116969 added to class.recursivedirectoryiterator

From: Date: Sun, 29 Mar 2015 02:58:34 +0000
Subject: note 116969 added to class.recursivedirectoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-202060@lists.php.net to get a copy of this message
In this doc page i see things for to hide hidden files (also for opendir() or readdir() .... this should be mentiond all there <?php // not hidden but on most OS systems Win, *nix, OSX.. if ($file == '.' || $file == '..') { // "." current dir info, // ".." dir above info, continue; ?> or <?php if $name[0] === '.' // NOT OK FOLKS ?> Think: "... and then came Polly.avi" is the title of the Movi. What do you do then? Windows does it different with hidden files than unix based systems. For unix based systems something like this should work: <?php if (preg_match('/^(\.\w+|\.$|\.\.$)/i', $location)) { /* is hidden: . .. .dir .file */ } // must be ok: "..some thing", "... some thing" ?> I know you do it (if $name[0] === '.' ) because it is much faster. But it is NOT correct and some day you miss things like me today :-) ---- Server IP: 72.52.91.14 Probable Submitter: 80.171.34.106 ---- Manual Page -- http://php.net/manual/en/class.recursivedirectoryiterator.php Edit -- https://master.php.net/note/edit/116969 Del: integrated -- https://master.php.net/note/delete/116969/integrated Del: useless -- https://master.php.net/note/delete/116969/useless Del: bad code -- https://master.php.net/note/delete/116969/bad+code Del: spam -- https://master.php.net/note/delete/116969/spam Del: non-english -- https://master.php.net/note/delete/116969/non-english Del: in docs -- https://master.php.net/note/delete/116969/in+docs Del: other reasons-- https://master.php.net/note/delete/116969 Reject -- https://master.php.net/note/reject/116969 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202060) next »