php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #35542 add ONLYFILES flag to glob() function
Submitted: 2005-12-04 09:03 UTC Modified: 2010-12-22 12:54 UTC
From: techtonik@php.net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.1 OS: W2K
Private report: No CVE-ID: None
 [2005-12-04 09:03 UTC] techtonik@php.net
Description:
------------
Currently glob() function returns an array containing the matched files/directories or FALSE on error. There is GLOB_ONLYDIR flag to return only directory entries which match the pattern, but no GLOB_ONLYFILES to get the opposite.


Reproduce code:
---------------
Valid flags: 

GLOB_MARK - Adds a slash to each item returned 
GLOB_NOSORT - Return files as they appear in the directory (no sorting) 
GLOB_NOCHECK - Return the search pattern if no files matching it were found 
GLOB_NOESCAPE - Backslashes do not quote metacharacters 
GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c' 
GLOB_ONLYDIR - Return only directory entries which match the pattern 


Expected result:
----------------
$files = glob("dir/*", GLOB_ONLYFILES);

Actual result:
--------------
$files = array_diff(glob("dir/*"), glob("dir/*", GLOB_ONLYDIR));

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-22 12:54 UTC] johannes@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-22 12:54 UTC] johannes@php.net
glob is wrapper around the POSIX glob() function. the fag has to be added to POSIX first therefore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 21:01:33 2024 UTC