any idea how files using file extension? eg. (.cfg)
i tried foreach (glob("*.cfg") $filename)
need know path in order use glob method.
as mentioned @bansi, should
the example given there should work you:
$basepath = "root/directory/for/search"; $start_directory = new recursivedirectoryiterator($basepath); $iterator = new recursiveiteratoriterator($iterator); $result = new regexiterator($iterator, '/^.+\.cfg$/i', recursiveregexiterator::get_match);
after got results, can access file paths in list entered via $basepath
:
foreach( iterator_to_array($result) $file) { echo "config found at: $file[0]"; }
you might find post useful well.
a little more background can found in this article.
Comments
Post a Comment