This guide explains how to identify Folder IDs and construct search queries for Drive-Bot.
- Share the Folder: Open Google Drive, right-click your folder, and select Share.
- Important: Set the permission to "Viewer" to allow the bot to read files without risking unintended modifications.
- Identify the ID: Copy the sharing link. It will look similar to this:
https://drive.google.com/drive/folders/0B9GvBjf6V7-MZTg4SUZJRWpTTFU?usp=sharingThe Folder ID is the unique string of characters afterfolders/. In the example above, the ID is0B9GvBjf6V7-MZTg4SUZJRWpTTFU.
These search strings are used to configure the $q variable inside config.php.
To search all files and folders within your entire Google Drive account:
$q = "";An empty string removes all location filters.
To search exclusively within one specific folder:
$q = "('[Folder_ID]' in parents) and ";Example:
$q = "('0B4FH8NB1ulOxfmR3TDljR2NPVlk1R2pVOFZ5b044S2J1SHFDUnNtbmpTUnpqNVk1MEJValU' in parents) and ";To filter results by their last modification date:
$q = "modifiedTime > '2023-01-01T12:00:00' and ";Supported operators include: >, <, =, <=, and >=.
To search across multiple specific folders simultaneously:
$q = "(('[Folder_ID_1]' in parents) or ('[Folder_ID_2]' in parents)) and ";Example:
$q = "(('0B4FH8NB1ulOxfmR3TDljR2NPVlk1R2pVOFZ5b044S2J1SHFDUnNtbmpTUnpqNVk1MEJValU' in parents) or ('0B9GvBjf6V7-MZTg4SUZJRWpTTFU' in parents)) and ";For more advanced query options, refer to the Google Drive API Documentation.
