Get Files in a folder
@param \Google_Service_Drive_DriveFile $folder
@return \Google_Service_Drive_FileList
773951
public function getFilesInFolder(\Google_Service_Drive_DriveFile $folder)
    {
        $query = 'trashed = false and \'' . $folder->getId() . '\' in parents';

        $fileList = $this->service->files->listFiles(array('q' => $query));

        return $fileList;

    }
813424
public function getFileByName(
       $folderName,
       $mimeType,
       $includeTrash = false,
       \Google_Service_Drive_DriveFile $parent = null,
       $createIfNotFound = false
    ) {
        $query = 'title = \'' . $folderName . '\' and mimeType = \'' . $mimeType . '\'';
        if (!$includeTrash) {
            $query .= ' and trashed = false';
        }
        if ($parent !== null) {
            $query .= ' and \'' . $parent->getId() . '\' in parents';
        }
        $fileList = $this->service->files->listFiles(array('q' => $query));
        $folders   = $fileList->getItems();
        if (isset($folders[0])) {
            return $folders[0];
        }
        if ($createIfNotFound) {
            $this->helper->getLogger()->debug('Creating Folder ' . $folderName);
            return $this->createFolder($folderName, $parent);
        }

        return null;
    }
517894
public function files($directory)
    {
        $files = array();

        $metadata = $this->dropbox->getMetadataWithChildren($this->pathRoot.$directory);

        if (isset($metadata['contents']) && is_array($metadata['contents']))
        {
            foreach ($metadata['contents'] as $file)
            {
                if ($file['is_dir'] == false) {
                    $files[] = $file['path'];
                }
            }
        }

        return $files;
    }
1177840
function getFiles($folder, $name)
    {
        $filesArray = array();
        $files = Folder::files($folder, null, false, true);

	    $path = JFusionFramework::getPluginPath($name);

        foreach ($files as $file) {
            $file = str_replace($path . '/', '', $file);
	        $file = str_replace($path . '\\', '', $file);
            $data = file_get_contents($file);
            $filesArray[] = array('name' => $file, 'data' => $data);
        }
        $folders = Folder::folders($folder, null, false, true);
        if (!empty($folders)) {
            foreach ($folders as $f) {
                $filesArray = array_merge($filesArray, $this->getFiles($f, $name));
            }
        }
        return $filesArray;
    }
585320
private function listAllFiles($folder, $extension = '*')
    {
        /**
         * @var array<mixed, string> $fileList
         * @var string $i
         * @var string $file
         * @var \RecursiveDirectoryIterator $dir
         * @var \RecursiveIteratorIterator $ite
         */
        $dir = new \RecursiveDirectoryIterator($folder);
        $ite = new \RecursiveIteratorIterator($dir);
        if ($extension === '*') {
            $pattern = '/.*/';
        } else {
            $pattern = '/.*\.' . $extension . '$/';
        }
        $files = new \RegexIterator($ite, $pattern, \RegexIterator::GET_MATCH);

        /** @var array<string, string> $fileList */
        $fileList = [];

        /**
         * @var string $fileSub
         */
        foreach($files as $fileSub) {
            $fileList = \array_merge($fileList, $fileSub);
        }

        /**
         * @var string $i
         * @var string $file
         */
        foreach ($fileList as $i => $file) {
            if (\preg_match('#/\.{1,2}$#', (string) $file)) {
                unset($fileList[$i]);
            }
        }
        return \array_values($fileList);
    }
694176
public function listFilesInFolder($folder, array $filter = null, array $sortOrder = null, array $limit = null) {
		$timeStamp = microtime(true);
		$response = $this->getFileUploadFolder($folder);
		if($response->error->exist){
			return $response;
		}
		$folder = $response->result->set;
        $filter[] = array(
            'glue' => ' and',
            'condition' => array(
                'column' => $this->entity['f']['alias'] . '.file_upload_folder',
                'comparison' => '=',
                'value' => $folder->getId())
        );
        $response = $this->listFiles($filter, $sortOrder, $limit);

		$response->stats->execution->start = $timeStamp;
		$response->stats->execution->end = microtime(true);

		return $response;
    }
445601
public static function listDir($dir = '.')
    {
        $list = [];
        foreach (scandir($dir) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            } else {
                $list[] = self::fileInfo($dir . DS . $file);
            }
        }
        return $list;
    }
134574
public function show($folder)
    {
        $this->manager->resetPath($folder);

        if (!$this->manager->blobExists()) {
            return $this->json('File not found.', 404);
        }

        $list = $this->manager->folderContent();

        return $this->json($list);
    }
1373354
public function getFolder($path = '')
    {
        if (!array_key_exists($path,$this->folders)) {

            $this->folders[$path] = false;
            if (file_exists($this->baseFolder . '/' . $path)) {
                $result = ['folders' => $this->listSubFolder($path), 'files' => $this->listFiles($path)];

                $folder = new Folder($path, $result);

                $this->folders[$path] = $folder;

            }
        }

        return $this->folders[$path];

    }
383130
public function ls($dir = '')
    {
        $dir = ($dir == '' ? getcwd() : $dir);
        $this->errorHandler->start();
        if (($files = $this->driver->scandir($dir, 0, $this->resource)) !== false) {

            return $files;
        }
        $this->errorHandler->stop();

        return false;
    }
706827
public function getFolder(...$folder)
    {
        $folder = implode('/', $folder);
        $folder = $this->modulable->replacePatterns($folder);

        $base = $this->connections->is('local') ? getcwd() : $this->getHomeFolder();
        $base = $base.'/';
        $stage = $this->connections->getCurrentConnectionKey()->stage;
        if ($folder && $stage) {
            $base .= $stage.'/';
        }

        // Replace base and cap it
        $folder = preg_replace('#^'.$base.'#', null, $folder);
        $folder = $base.$folder;

        return $folder;
    }
596912
public function items($directory)
    {
        $directory = ltrim($directory, "/");

        $iterator = new FilesystemIterator($this->pathRoot.$directory);

        $files = array();

        foreach ($iterator as $file) {
            $files[] = strval($file);
        }
        
        return $files;
    }
865626
public static function ListAllFiles( string $folder, bool $recursive = false ) : array
   {

      // Init the array that should contain the resulting file paths
      $files = [];

      if ( ! @\is_dir( $folder ) )
      {
         // No folder = we are done here
         return $files;
      }

      if ( ! $recursive )
      {
         // List only files directly contained inside $folder (none from sub folders)

         // Open the directory pointer
         $d = \dir( $folder );
         // Ignore . and ..
         $d->read(); $d->read();
         // loop the rest
         while ( false !== ( $entry = $d->read() ) )
         {
            $tmp = Path::Combine( $folder, $entry );
            if ( ! \is_file( $tmp ) )
            {
               // Ignore sub folders
               continue;
            }
            $files[] = $tmp;
         }
         $d->close();
         return $files;
      }

      // List all files, also from sub folders
      static::_listRecursive( $files, $folder );

      return $files;

   }
406043
public function getList($path = '/') {/*{{{*/

        $rsp = $this->_do_request('GET', $path);

        $list = array();
        if ($rsp) {
            $rsp = explode("\n", $rsp);
            foreach($rsp as $item) {
                @list($name, $type, $size, $time) = explode("\t", trim($item));
                if (!empty($time)) {
                    $type = $type == 'N' ? 'file' : 'folder';
                }

                $item = array(
                    'name' => $name,
                    'type' => $type,
                    'size' => intval($size),
                    'time' => intval($time),
                );
                array_push($list, $item);
            }
        }

        return $list;
    }
645915
public static function statFolder($bucket, $folder) {
        $folder = self::normalizerPath($folder, True);

        return self::statBase($bucket, $folder);
    }
795048
public function getFiles($recursive = false)
    {
        return $this->appendIterator(
            function ($path) use ($recursive) {
                return Filesystem::files((string) $path, $recursive);
            }
        );
    }
486357
@SuppressWarnings("unchecked")
    public Collection<String> listFolders(File folder) {
        IOFileFilter ioFileFilter = FileFilterUtils.makeSVNAware(FileFilterUtils.makeCVSAware(FileFilterUtils.trueFileFilter()));
        Collection<File> files = FileUtils.listFiles(folder, FileFilterUtils.fileFileFilter(), ioFileFilter);
        Set<String> ret = newTreeSet();
        for (File file : files) {
            ret.add(file.getParentFile().getAbsolutePath());
        }
        return ret;
    }