Delete File/Folder

📌 Definition

The Delete File/Folder action in the Google Workspace category allows you to remove a specific file or folder from a user’s Google Drive. 🗑️ Depending on your configuration, the file/folder can either be moved to Trash or permanently deleted without the option to recover it.

This action is especially useful for automating clean-up tasks, enforcing document retention policies, or managing shared drive contents. It works by securely connecting through a service account with domain-wide delegation, ensuring authorized and compliant file management across your organization. 🔐

Key Capabilities:

  • Delete sensitive or outdated files/folders automatically.
  • Choose between temporary (Trash) or permanent deletion.
  • Manage file removals at scale for any user in your domain.

Example Use cases

🧹 Automated Drive Clean-Up

Schedule regular deletion of temporary or old files from specific users’ Drives to keep storage organized and efficient.

🔒 Compliance & Retention Policy Enforcement

Automatically delete files that exceed retention periods or contain sensitive data that should no longer be stored.

👥 Offboarding Employees

Remove or archive unnecessary personal or work files from the Drive of a recently offboarded employee as part of the user deprovisioning process.

📁 Clear Shared Folders

lean up shared folders by deleting outdated or duplicate content across your team’s shared space.

Workflow Finalization

As part of an approval or workflow process, delete draft versions or rejected files to avoid confusion and reduce clutter.


Inputs

🔌 Connection

This is the Google Workspace Administration connection that gives the action permission to access and manage Google Drive files on behalf of users.

⚠️

You need to upload a service account credential JSON file with domain-wide delegation enabled.
📖 Guide to set this up

📧 User Email

The email address of the user who owns the file or folder you want to delete.

This action acts on behalf of this user, so make sure the service account has access to their files.

🆔 File or Folder ID

The unique identifier of the file or folder you want to delete.
You can find the ID in the file or folder's link, like so: 🔗 https://drive.google.com/file/d/**123456abcdef**/view ➡️ The File ID here is 123456abcdef.

🗑️ Deletion Type

Specifies how you want to delete the file or folder:

  • Move to Trash: The file/folder is sent to the user’s trash. It can still be recovered until it is permanently deleted manually or after 30 days.
  • Permanently Delete: Completely removes the file/folder without going to the trash.

⚠️

This is irreversible — use with caution.


📁 Example Scenario: Automatic Document Deletion After Form Submission

Context:
Imagine your company has an internal form that employees use to upload confidential reports. Once the reports are submitted, the files are temporarily stored in a shared Google Drive folder. However, after the review process, these files must be deleted to maintain privacy and data security.


How This Action Helps:

  • Trigger: A form submission (which includes a file upload).
  • Action: After the form is submitted, the "Delete File/Folder" action is triggered to remove the file from the user's Google Drive.

🔄 Steps:

  1. Employee submits a report: The employee fills out a form and uploads a report (e.g., a confidential document).
  2. Zenphi Flow activates: Upon submission, Zenphi’s flow retrieves the File ID and User Email from the form.
  3. Delete File: Zenphi automatically moves the file to the trash (or permanently deletes it, depending on your choice) from the user’s Google Drive.

Outcome:

The file is removed from Google Drive, reducing manual effort and ensuring confidentiality in the document handling process.