cakePHP读取文件夹目录,仅显示某些文件类型

I'd like to not show any .db files when listing all the files in a folder.

Here's my code:

$ticketId = 100;
$uploadPath = Configure::read('Config.uploadPath').'/support_tickets/';
$dir = new Folder($uploadPath.$ticketId);
$fileList = $dir->read(true, array('*.db'));

Right now $fileList stores all the files.

How do I write the statement correctly?

I would try $files = $dir->find('.*.db', false);

Iterators are great for this type of thing. Here is a basic one for SVG files

/**
 * @brief SvgIterator for finding svg files
 */
class SvgIterator extends FilterIterator {
    public function accept() {
        $isSvg = $this->current()->getExtension() == 'svg';
        if(!$isSvg) {
            return false;
        }

        return $this->_getData();
    }

/**
 * @brief method for getting data from the SVG files
 *
 * @return boolean
 */
    protected function _getData() {
        $this->current()->_aspectRatio = SvgConvert::aspectRatio($this->current()->getPathname());

        return true;
    }

/**
 * @brief calculate the aspect ratio of the curret file
 *
 * @return float
 */
    public function aspectRatio() {
        return $this->current()->_aspectRatio;
    }
}

And usage:

$it = new SvgIterator(
    new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($path)));

$return = array();
for ($it->rewind(); $it->valid(); $it->next()) {
    $file = array(
        'file' => $it->current()->getFilename(),
        'aspect_ratio' => $it->aspectRatio()
    );

    $return[] = $file;
}