note 84218 added to function.glob

From: Date: Thu, 03 Jul 2008 19:17:10 +0000
Subject: note 84218 added to function.glob
Groups: php.notes 
Request: Send a blank email to php-notes+get-141124@lists.php.net to get a copy of this message
sory for my english first. I ve been trying to reach out how can i recognize an empty direcotry. But everytime was the same problem. even the directory was empty, the result of count(glob.... was always 1. So i wrote this short code and it works fine: $dir = "directory"; //setting directory $count = count(glob("$dir/*.*")); //if there is more than 1 filer the result is correct if ($count==1) {$onepath=glob("$dir/*.*"); if ($onepath[0]=="") $count=0;} // the result can by 1 even the directory is empty, so if the result is 1 the prog. seek the result of 0 /first record in array/ and check if is emty or not. easy. try it!! ---- Server IP: 217.73.17.12 Probable Submitter: 78.99.138.18 ---- Manual Page -- http://www.php.net/manual/en/function.glob.php Edit -- https://master.php.net/note/edit/84218 Del: integrated -- https://master.php.net/note/delete/84218/integrated Del: useless -- https://master.php.net/note/delete/84218/useless Del: bad code -- https://master.php.net/note/delete/84218/bad+code Del: spam -- https://master.php.net/note/delete/84218/spam Del: non-english -- https://master.php.net/note/delete/84218/non-english Del: in docs -- https://master.php.net/note/delete/84218/in+docs Del: other reasons-- https://master.php.net/note/delete/84218 Reject -- https://master.php.net/note/reject/84218 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141124) next »