PHP + Wordpress - get a list of files from a directory

Possible duplicate:
Best way to get files from a directory filtered by a specific extension in php

Are there any native WP features that can display files based on an extension from a directory? if not, how to do it with php?

I want to get the file names of all .css files from a specific folder

+5
source share
3 answers

I do not know about wordpress

But in PHP you need the glob command - http://php.net/glob

+5
source

Use globas follows:

$file_paths = glob('/path/to/files/*.extension');
+4
source

glob

$files=glob("/path/to/your/folder/*.css");
foreach ($files as $file) {
    echo "$file<br>";
}
+3

All Articles