View Single Post
Old 10-05-2012, 10:42 PM   PM User | #13
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
There is no corresponding GLOB_ONLYFILE directive. However, so long as you have named extensions, then you can simply use a glob pattern of '/*.*'. If you don't have extensions, you'll need to make use of !is_dir.

Alternatively, you can pull a glob() of all records, and a glob of GLOB_ONLYDIR. Then you can use array_diff to remove the ones from the only directories glob from the entire glob which will leave you with only the files.
That should be doable as such (I can't test this where I am I'm afraid):
PHP Code:
$sPath realpath($directory) . '/*';
$aDirectories glob($sPathGLOB_ONLYDIR);
$aAll glob($sPath);
$aFiles array_diff($aAll$aDirectories); 
$aFiles should just be the files.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
LJackson (10-05-2012)