Core/Toolbox/IO/File.php
public function getFilenamesFromDir($path, $recursive = false)
    {
        // Add trailing slash if missing
        if (substr($path, -1) != '/') {
            $path .= '/';
        }

        $path = $this->replaceDirectorySeperator($path);

        $filenames = [];

        // No handle, error exception
        if (!file_exists($path)) {
            Throw new FileException(sprintf('Path "%s" not found.', $path, 2000));
        }

        $files = scandir($path);

        foreach ($files as $file) {

            // no '.' or '..'
            if ($file{0} == '.') {
                continue;
            }

            if (is_dir($path . $file) && $recursive) {
                $filenames[$file] = $this->getFilenamesFromDir($path . $file, $recursive);
            }
            else {
                continue;
            }

            // store filename
            $filenames[$file] = $file;
        }

        return $filenames;
    }
public function getFilenamesFromDir($path, $recursive = false)
    {
        // Add trailing slash if missing
        if (substr($path, -1) != '/') {
            $path .= '/';
        }

        $path = $this->replaceDirectorySeperator($path);

        $filenames = [];

        // No handle, error exception
        if (!file_exists($path)) {
            Throw new FileException(sprintf('Path "%s" not found.', $path, 2000));
        }

        $files = scandir($path);

        foreach ($files as $file) {

            // no '.' or '..'
            if ($file{0} == '.') {
                continue;
            }

            if (is_dir($path . $file) && $recursive) {
                $filenames[$file] = $this->getFilenamesFromDir($path . $file, $recursive);
            }
            else {
                continue;
            }

            // store filename
            $filenames[$file] = $file;
        }

        return $filenames;
    }
Returns an array of files inside the given directory path.

@param string $path
Directory path to get filelist from

@throws FileException

@return void multitype:string