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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: techtonik@php.net
New email:
PHP Version: OS:

 

 [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 19:01:30 2024 UTC