I'm trying to develop a PHP script which goes through my Google Drive to list my files . I have the current structure :
-- logo1.png
|
|-- logo2.png
|
-- myFolder
| |
| --logo3.png
|
|
-- myPrivateFolder
|
--logo4.png
I'm using the Google PHP library to make my queries. To list my files, I have this code :
$client = new Google_Client();
$client->setAuthConfig($oauth_credentials);
$client->setRedirectUri($redirect_uri);
$client->addScope("https://www.googleapis.com/auth/drive");
$service = new Google_Service_Drive($client);
$result = array();
try {
$parameters = array(
'q' => "mimeType contains 'image/'",
);
$files = $service->files->listFiles($parameters);
$result = array_merge($result, $files->getFiles());
} catch (Exception $e) {
print "Une erreur s'est produite : " . $e->getMessage();
}
return $result;
$result is an array of 4 elements. Since I specified I only want MIME type 'image/', I only get my 4 images. Now, I'd like to know, how can I filter my results to exclude my private directory from the research ? I want to be able to specify in which folder not to look ?
I wasn't able to find in the documentation anything about that. Thanks in advance for any help !