Gws Drive

Google Drive: Manage files, folders, and shared drives

What Is This?

Overview

Gws Drive is a command-line interface skill built on top of the Google Workspace CLI tool, designed to manage files, folders, and shared drives directly from the terminal. It wraps the Google Drive API v3 into a structured set of subcommands, allowing users to perform file operations, folder management, and shared drive administration without opening a browser or using the web interface. The skill is part of the broader gws toolset, which covers multiple Google Workspace services under a unified CLI framework.

The skill follows a consistent gws drive <resource> <method> [flags] pattern, making it predictable and scriptable. Whether you are listing files in a shared drive, uploading documents, or managing permissions, each operation maps to a clear resource and method combination. Authentication and global configuration are handled by the shared gws foundation, so credentials and security rules are managed in one place rather than repeated across each command.

For teams and individuals who rely on Google Drive as a central storage layer, this skill provides a programmatic interface that integrates naturally into automation pipelines, CI/CD workflows, and administrative scripts. It removes the manual overhead of navigating the Drive web interface for repetitive or bulk operations.

Who Should Use This

  • Developers who need to automate file uploads, downloads, or organization as part of build or deployment pipelines.
  • System administrators managing shared drives, folder structures, and access permissions across a Google Workspace organization.
  • Data engineers who regularly transfer files between local systems and Google Drive as part of data ingestion or export workflows.
  • DevOps engineers looking to integrate Google Drive operations into shell scripts or infrastructure automation tools.
  • Technical teams that need to audit file metadata, ownership, or sharing settings at scale without manual effort.
  • Power users who prefer terminal-based workflows and want to avoid context-switching to a browser for routine Drive tasks.

Why Use It?

Problems It Solves

  • Manual file management through the Drive web interface is slow and error-prone when dealing with large numbers of files or folders.
  • Automating Drive operations without a CLI requires writing custom API integration code, which adds development overhead and maintenance burden.
  • Bulk permission changes or folder restructuring are tedious through the GUI and nearly impossible to audit or reproduce consistently.
  • Integrating Drive file operations into CI/CD pipelines or cron jobs requires a scriptable interface that the web UI cannot provide.
  • Shared drive administration tasks, such as managing members or auditing content, lack efficient tooling outside of the web console.

Core Highlights

  • Consistent gws drive <resource> <method> command structure across all operations.
  • Full support for files, folders, and shared drives as distinct resource types.
  • Scriptable output suitable for piping into other tools or parsing in shell scripts.
  • Leverages centralized authentication from the gws shared configuration.
  • Supports flag-based filtering, pagination, and field selection for precise queries.
  • Works within the Google Drive API v3 feature set, including metadata operations.
  • Integrates with the broader Google Workspace CLI ecosystem for cross-service workflows.

How to Use It?

Basic Usage

Before running any Drive commands, ensure the gws binary is installed and authentication is configured according to the shared skill prerequisites.

## List files in the root of My Drive
gws drive files list

## Get metadata for a specific file by ID
gws drive files get --fileId <FILE_ID>

## Upload a local file to Drive
gws drive files create --name "report.pdf" --localFilePath ./report.pdf

## List all shared drives accessible to the authenticated account
gws drive drives list

Specific Scenarios

Scenario 1: Organizing files into a folder

## Create a new folder
gws drive files create --name "Q4 Reports" --mimeType application/vnd.google-apps.folder

## Move a file into the folder
gws drive files update --fileId <FILE_ID> --addParents <FOLDER_ID> --removeParents root

Scenario 2: Auditing shared drive membership

## List members of a specific shared drive
gws drive drives members list --driveId <DRIVE_ID>

Scenario 3: Searching for files by name

## Query files matching a name pattern
gws drive files list --q "name contains 'invoice'"

Real-World Examples

  • A finance team runs a nightly cron job that uploads generated invoice PDFs to a designated shared drive folder using gws drive files create.
  • A DevOps engineer uses gws drive files list with query flags to audit all files shared externally before a security review.
  • A data pipeline script downloads processed CSV exports from Drive using gws drive files get and feeds them into a local database loader.