List Folder
Lists the contents of a folder in Google Drive.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Drive Id - The identifier for the connected Google Drive service obtained from the Connect node.
- Folder Id - The unique identifier of the folder whose contents should be listed.
Options
- Include Folders - If enabled, folders will be included in the results. If disabled, only files will be returned.
Output
- files - An array of file objects containing details about each file/folder in the specified folder. Each object includes:
- Id - The unique identifier of the file/folder
- Name - The name of the file/folder
- Parents - An array of parent folder IDs
- Kind - The type of the file/folder
- Size - The size of the file in bytes (0 for folders)
- CreatedTime - The time the file/folder was created
- ModifiedTime - The time the file/folder was last modified
How It Works
The List Folder node retrieves the contents of a specified folder in Google Drive. When executed, the node:
- Validates the required inputs (Drive Id and Folder Id)
- Retrieves the Google Drive service client using the provided Drive Id
- Constructs a query to list files in the specified folder
- If Include Folders is disabled, adds a filter to exclude folders from the results
- Uses the Google Drive API to list the files with the Files.List method
- Processes the results into a standardized format
- Returns the array of file objects
Requirements
- A valid Google Drive connection established using the Connect node
- The Folder Id of an existing folder in Google Drive
- Appropriate permissions to read the folder contents
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Drive Id
- Empty or invalid Folder Id
- Google Drive API errors during file listing
- Insufficient permissions to read the folder contents
- Attempting to list a folder that doesn't exist
Usage Notes
- The root folder of a Google Drive has the ID "root"
- The output contains metadata about the files but not their content
- To get file content, use the Download or Export nodes after listing
- The Include Folders option allows you to control whether subfolders appear in the results
- The returned file objects can be used in subsequent nodes to process individual files
- Large folders may take longer to list depending on the number of items