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;
    }
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;
    }
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 ; }
Get a file
@param $folderName
@param $mimeType
@param bool $includeTrash
@param \Google_Service_Drive_DriveFile $parent
@param bool $createIfNotFound
@return \Google_Service_Drive_DriveFile|null
Get a file