Returns List of Files statically.
@access		public
@static
@param		string		$path				Path to Folder
@param		string		$pattern			RegEx Pattern to match with File Name
@return		FilterIterator
198756
public static function getFileList( $path, $pattern = NULL )
	{
		$index	= new FS_Folder_RecursiveLister( $path );
		$index->setPattern( $pattern );
		$index->showFiles( TRUE );
		$index->showFolders( FALSE );
		return $index->getList();
	}
1174478
public function hasFilesWithName($pattern)
    {
        $result = $this->getFiles(Finder::create()->name($pattern));

        return count($result) !== 0;
    }
1278746
public function getMappingFiles($path)
    {
        $files = $this->files->glob($path.'/*_*.php');

        if ($files === false) {
            return [];
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));
        }, $files);

        return $files;
    }
396337
protected function findFilesInCacheDir($pattern)
    {
        $finder = new Finder();
        
        return $finder
            ->name($pattern)
            ->in($this->getCacheDir())
        ;
    }
219401
public function extract($path, $regex = null)
    {
        $directory = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
        $iterator = new RecursiveIteratorIterator($directory);

        if ($regex) {
            $iterator = new RegexIterator($iterator, $regex);
        }

        $this->iterator->attachIterator($iterator);

        return $this;
    }
1147361
protected function extractParameterValues($pattern, $path, array $patterns = []) {
        $path = $this->addTrailingSlash($path);
        $matches = [];

        $pattern = $this->createRegexPattern($pattern, $patterns);
        preg_match_all($pattern, $path, $matches);
        array_shift($matches);

        $values = $this->processParameterValues($matches);

        return $values;
    }
1271776
public function readDirRecursive( $dir, $pattern ) {

		$sub_dirs = glob( $dir . '/*', \GLOB_ONLYDIR );
		$files = array();
		if ( ! empty( $sub_dirs ) ) {
			foreach ( $sub_dirs as $sub_dir ) {
				$files = array_merge( $files, $this->readDirRecursive( $sub_dir, $pattern ) );
			}
		}
		$files = array_merge( $files, glob( $dir . '/' . $pattern, \GLOB_NOCHECK ) );

		return $files;
	}
703664
function filteredFiles(folder, pattern) {
  var files = [];
    
  if (fs.existsSync(folder)){
    fs.readdirSync(folder).forEach(function(file) {
      if (file.match(pattern) != null)
        files.push(file);
    });
  }
  return files;
}
244268
private function getFiles($path)
    {
        $files = [];

        if (false !== $pos = strpos($path, '*')) {
            list($before, $after) = explode('*', $path, 2);
            $input = $this->fileLocator->locate($before).'*'.$after;

            if (false !== $paths = glob($input)) {
                foreach ($paths as $path) {
                    $files[] = $path;
                }
            }
        } else {
            $files = [$this->fileLocator->locate($path)];
        }

        return $files;
    }
615614
protected function getFilesByPattern($pattern)
    {
        $iterator = Injector::inst()->create('GreenFinder')
            ->in($this->getPath())
            ->name($pattern);
        $files = [];

        foreach ($iterator as $file) {
            $files[] = $this->getRelativePath() . '/' . $file->getRelativePathname();
        }

        return $files;
    }
191818
public function listFiles(string $path = '', bool $recursive = false)
    {
        $contents = $this->listContents($path, $recursive);

        $filter = function ($object) {
            return $object['type'] === 'file';
        };

        return \array_values(\array_filter($contents, $filter));
    }
930071
protected function filter($path, array $patterns)
    {
        foreach ($patterns as $pattern) {
            if ($pattern[0] == '!' ? !fnmatch(substr($pattern, 1), $path) : fnmatch($pattern, $path)) {
                return false;
            }
        }

        return true;
    }
454664
public function findFiles(string $pattern, int $flags = 0): FileCollection
    {
        $files = glob($this->path.'/'.$pattern, $flags);
        foreach ($files as $index => $file) {
            if (is_file($file)) {
                $files[$index] = new File($file);
            } else {
                unset($files[$index]);
            }
        }

        return new FileCollection($files);
    }
649533
public function directories($directory, $pattern = '*')
    {
        $all = array_filter($this->listDirectory($directory), function ($path) {
            return $this->type($path) == 'dir';
        });

        return $this->filterPaths($all, $pattern);
    }
1153383
public function getAllFiles($path){
        $fullpath = $this->getFullPath().$path;
        if(file_exists($fullpath)){
            $file = new \SplFileInfo($fullpath);
            if($file->isDir()){
                $r = array();
                // if($path != "/") $r[] = $this->folderParent($path);
                $finder = new Finder();
                $directories = $finder->notName($this->config['folder_thumb']);
                if (count($this->config['folder_excludes'])>0) {
                    foreach ($this->config['folder_excludes'] as $value) {
                        $directories = $finder->notName($value);
                    }
                }
                //$directories = $directories->notName('web.config')->notName('.htaccess')->depth(0)->sortByType();
                $directories = $directories->notName('web.config')->notName('.htaccess')->depth(0)->sort(
                    function ($a, $b) {return $b->getMTime() - $a->getMTime();}
                    );
                // $directories = $directories->files()->name('*.jpg');
                $directories = $directories->in($fullpath);
                foreach ($directories as $key => $directorie) {
                    $namefile = $directorie->getFilename();
                    if($directorie->isDir() && $this->validNameFile($namefile,false)){
                        $t = $this->dirInfo($directorie,$path);
                        if($t) $r[] = $t;
                    }elseif($directorie->isFile() && $this->validNameFile($namefile)){
                        $t = $this->fileInfo($directorie,$path);
                        if($t) $r[] = $t;
                    }
                }
                return $r;
            }elseif($file->isFile()){
                $t = $this->fileInfo($file,$path);
                if($t){
                    return $t;
                }else{
                    $result = array("query"=>"BE_GETFILEALL_NOT_LEIBLE","params"=>array());
                    $this->setInfo(array("msg"=>$result));
                    if( $this->config['debug'] ) $this->_log(__METHOD__." - Archivo no leible - $fullpath");
                    return;
                }
            }elseif($file->isLink()){
                $result = array("query"=>"BE_GETFILEALL_NOT_PERMITIDO","params"=>array());
                $this->setInfo(array("msg"=>$result));
                if( $this->config['debug'] ) $this->_log(__METHOD__." - path desconocido - $fullpath");
                return ;
            }
        }else{
            $result = array("query"=>"BE_GETFILEALL_NOT_EXISTED","params"=>array());
            $this->setInfo(array("msg"=>$result));
            if( $this->config['debug'] ) $this->_log(__METHOD__." - No existe el archivo - $fullpath");
            return ;
        }
    }
383945
private function get_files_from_folders( $path ) {

		$items = $this::get_folder_contents( $path );

		foreach ( $items as $type => &$location ) {
			$location = $this::get_folder_contents( trailingslashit( $location ) );
			sort( $location );
		}

		return $items;
	}
1246162
public function name($pattern)
	{
		$regex = FilenameMatch::translate($pattern);
		$this->names[] = $regex;

		return $this;
	}