PHPackages                             wp-packagist/wp-cli-gdrive-command - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. wp-packagist/wp-cli-gdrive-command

ActiveWp-cli-package[CLI &amp; Console](/categories/cli)

wp-packagist/wp-cli-gdrive-command
==================================

Google Drive Cloud Storage for WP-CLI

v1.0.7(6y ago)4651[2 issues](https://github.com/wp-packagist/wp-cli-gdrive-command/issues)MITPHPPHP ^5.5 || ^7.0CI failing

Since Jun 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/wp-packagist/wp-cli-gdrive-command)[ Packagist](https://packagist.org/packages/wp-packagist/wp-cli-gdrive-command)[ Docs](https://github.com/wp-packagist/wp-cli-gdrive-command)[ RSS](/packages/wp-packagist-wp-cli-gdrive-command/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (3)Versions (8)Used By (0)

WP-CLI Google Drive Command
===========================

[](#wp-cli-google-drive-command)

Use Google Drive Storage in WordPress WP-CLI Command line for Backup/Restore Files.

[![Build Status](https://camo.githubusercontent.com/f072df2570304c902576736251fb1151c726d2cac8ed00b5405a4669bd63c7e9/68747470733a2f2f7472617669732d63692e636f6d2f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/wp-packagist/wp-cli-gdrive-command)[![GitHub](https://camo.githubusercontent.com/c5a2ff8906e35043799facb11f13fe9f379030af997100e09478b7b788f8c778/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e737667)](https://camo.githubusercontent.com/c5a2ff8906e35043799facb11f13fe9f379030af997100e09478b7b788f8c778/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e737667)[![GitHub repo size](https://camo.githubusercontent.com/5cee586e302807f08e6ba49c451aeb2fc127ded256b09463d705241321b51e6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e737667)](https://camo.githubusercontent.com/5cee586e302807f08e6ba49c451aeb2fc127ded256b09463d705241321b51e6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e737667)[![GitHub release](https://camo.githubusercontent.com/faae67747f9aa00c081879ce3e9d3c5da585c3de6e6a22792a493ac9edcaea80/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e7376673f7374796c653d736f6369616c)](https://camo.githubusercontent.com/faae67747f9aa00c081879ce3e9d3c5da585c3de6e6a22792a493ac9edcaea80/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f77702d7061636b61676973742f77702d636c692d6764726976652d636f6d6d616e642e7376673f7374796c653d736f6369616c)

[![WP-CLI Google Drive](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/logo.png)](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/logo.png)

- [WP-CLI Google Drive Command](#wp-cli-google-drive-command)
    - [Installation](#installation)
        - [Authenticate Users](#authenticate-users)
    - [Structure](#structure)
    - [Commands](#commands)
        - [List of files and folder](#list-of-files-and-folder)
        - [Create folder in Google Drive](#create-folder-in-google-drive)
            - [Nested Directory](#nested-directory)
        - [Download File](#download-file)
            - [Auto Extract after download](#auto-extract-after-download)
        - [Copy files or Folder](#copy-files-or-folder)
        - [Move files or Folder](#move-files-or-folder)
        - [Remove Files or folder](#remove-files-or-folder)
        - [Rename a file or folder](#rename-a-file-or-folder)
        - [Get Share Link For a files or folder](#get-share-link-for-a-files-or-folder)
        - [Private a files or folder](#private-a-files-or-folder)
        - [List of files and folder in trash](#list-of-files-and-folder-in-trash)
            - [Clear all files in trash](#clear-all-files-in-trash)
        - [Restore Files or folder](#restore-files-or-folder)
        - [Get Your Storage](#get-your-storage)
        - [Upload Files or Folder](#upload-files-or-folder)
    - [Author](#author)
    - [Contributing](#contributing)

Installation
------------

[](#installation)

you can install this package with:

```
wp package install wp-packagist/wp-cli-gdrive-command
```

> Installing this package requires WP-CLI v2 or greater. Update to the latest stable release with `wp cli update`.

### Authenticate Users

[](#authenticate-users)

Step 1: Go to [Google Developers console](https://console.developers.google.com/) and Create a new project

[![Create new Project in Google Console](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-1.jpg)](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-1.jpg)

Step 2: Create an OAuth client ID

 [![OAuth client ID in Google developer](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-2.jpg)](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-2.jpg)

You can select Other types for the project.

 [![OAuth client ID in Google developer](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-3.jpg)](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-3.jpg)

Then copy your Client Id and Client secret.

 [![Get Client Id and Client Secret](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-4.jpg)](https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-4.jpg)

Step3 : run command and enter your Client id and Client secret.

```
wp gdrive auth
```

> if you want change gmail account that saved before. use 'wp gdrive auth --force'.

Structure
---------

[](#structure)

```
NAME

  wp gdrive

DESCRIPTION

  Google Drive Cloud Storage.

SYNOPSIS

  wp gdrive

SUBCOMMANDS

  auth         Verify user identity on Google.
  copy         Copy a file or folder.
  get          Download a file.
  ls           List of files and folder.
  mkdir        Create folder in Google Drive.
  move         Move a file or folder.
  private      Private a file or folder.
  rename       Rename a file or folder.
  restore      Restore a file and folder from trash.
  rm           Remove File or folder By Path.
  share        Get Download Link a file or folder.
  storage      Verify user identity on Google.
  trash        List of files and folder in trash.
  upload       Upload a file.

```

Commands
--------

[](#commands)

List of WP-CLI gdrive Commands :

### List of files and folder

[](#list-of-files-and-folder)

For show list all files and folder in root dir :

```
wp gdrive ls
```

For show list of files from custom path e.g /wordpress/backup

```
wp gdrive ls /wordpress/backup
```

### Create a folder in Google Drive

[](#create-a-folder-in-google-drive)

For creating a folder use :

```
wp gdrive mkdir
```

create `backup` folder in the root directory:

```
wp gdrive mkdir backup
```

#### Nested Directory

[](#nested-directory)

you can also create nested dir. for example:

```
wp gdrive mkdir wordpress/new-project/backup
```

### Download File

[](#download-file)

```
wp gdrive get   [--name=new_name] [--e]
```

Download backup.zip file from root dir in Google Drive:

```
wp gdrive get backup.zip
```

Download backup.zip file and save to custom dir with `package.zip` name:

```
wp gdrive get backup.zip /folder/ --name=package.zip
```

#### Auto Extract after download

[](#auto-extract-after-download)

Automatic unzip file after download: (use --e flag) Download Backup.zip file and extract to /folder/.

```
wp gdrive get backup.zip /folder/ --e
```

### Copy files or Folder

[](#copy-files-or-folder)

```
wp gdrive copy
```

> `new-path` is only new dir path.

for example copy file:

```
wp gdrive copy /backup/wp.zip /folder/custom/
```

or copy folder:

```
wp gdrive copy /folder/name/ /custom
```

### Move files or Folder

[](#move-files-or-folder)

```
wp gdrive mv
```

or

```
wp gdrive move
```

For example:

```
wp gdrive move /folder/wordpress.zip /folder/custom/
```

### Remove Files or folder

[](#remove-files-or-folder)

```
wp gdrive rm  [--trash] [--force]
```

or

```
wp gdrive remove  [--trash] [--force]
```

Path: files or folder path e.g. /backup/wp.zip --trash: Move file to trash. --force: Force removing file and folder without question.

For example remove wordpress.zip file in root directory and move to trash:

```
wp gdrive rm wordpress.zip --trash
```

### Rename a file or folder

[](#rename-a-file-or-folder)

```
wp gdrive ren
```

or

```
wp gdrive rename
```

For example, rename wp.zip files that stored in backup folder to wordpress.zip:

```
wp gdrive ren /backup/wp.zip wordpress.zip
```

Rename a folder:

```
wp gdrive ren /folder/folder/ new_folder_name
```

### Get Share Link For a files or folder

[](#get-share-link-for-a-files-or-folder)

If you want to share files or folder and get public link use:

```
wp gdrive share
```

for example, get download link /backup/wp.zip file:

```
wp gdrive share /backup/wp.zip
```

### Private a files or folder

[](#private-a-files-or-folder)

after download files or folder by others, you can private again file or folder:

```
wp gdrive private
```

for example, disable download link /backup/wp.zip file:

```
wp gdrive private /backup/wp.zip
```

### List of files and folder in the trash

[](#list-of-files-and-folder-in-the-trash)

For showing list of all files and folders in Google Drive Trash:

```
wp gdrive trash
```

#### Clear all files in the trash

[](#clear-all-files-in-the-trash)

```
wp gdrive trash --clear
```

### Restore Files or folder

[](#restore-files-or-folder)

Use this command:

```
wp gdrive restore
```

for example, restore `backup` folder from Google drive trash:

```
wp gdrive restore /backup/
```

### Get Your Storage

[](#get-your-storage)

For getting your Storage:

```
wp gdrive storage
```

or

```
wp gdrive about
```

### Upload Files or Folder

[](#upload-files-or-folder)

```
 wp gdrive upload [] [] [--name=] [--zip] [--force]
```

path : The path of file or folder for Upload. `default is current path`

UploadTo : The path dir where the file will be saved in Google Drive.

\--name : New file name to save.

\--zip : Create Zip file before uploading.

\--force : Force upload even if it already exists.

---

Automatic create zip file archive file from all root directory and files and upload to GDrive:

```
wp gdrive upload --zip
```

Upload backup.zip file to root dir in Google Drive:

```
wp gdrive upload backup.zip
```

Automatic create zip archive from the /wp-content/ folder and upload to custom dir:

```
wp gdrive upload /wp-content/ /wordpress/backup --zip
```

Upload All files from `/wp-content/plugins/my-plugin/docs` to `wordpress/plugin` directory in Google Drive

```
wp gdrive upload /wp-content/plugins/my-plugin/docs/ /wordpress/plugin --zip
```

> Number Max files in One Request is 100 files

Upload with a custom name.

```
wp gdrive upload backup.zip --name=wordpress.zip
```

Get Backup From WordPress Database and Upload to Google Drive:

```
wp db export backup.sql
wp gdrive upload backup.sql /backup/wordpress
```

Author
------

[](#author)

- [Mehrshad Darzi](https://www.linkedin.com/in/mehrshaddarzi/) | PHP Full Stack and WordPress Expert

Contributing
------------

[](#contributing)

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

### Reporting a bug

[](#reporting-a-bug)

Think you’ve found a bug? We’d love for you to help us get it fixed. Before you create a new issue, you should [search existing issues](https://github.com/wp-packagist/wp-cli-gdrive-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

### Creating a pull request

[](#creating-a-pull-request)

Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-packagist/wp-cli-gdrive-command/issues/new) to discuss whether the feature is a good fit for the project.

Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:

1. Create a feature branch for each contribution.
2. Submit your pull request early for feedback.
3. Follow [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Recently: every ~3 days

Total

7

Last Release

2314d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/949491?v=4)[Mehrshad Darzi](/maintainers/mehrshaddarzi)[@mehrshaddarzi](https://github.com/mehrshaddarzi)

---

Top Contributors

[![mehrshaddarzi](https://avatars.githubusercontent.com/u/949491?v=4)](https://github.com/mehrshaddarzi "mehrshaddarzi (54 commits)")

---

Tags

googlegoogle-apigoogle-drivewordpresswp-cliwp-cli-commandwp-cli-packagecliwordpresswp-cli

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wp-packagist-wp-cli-gdrive-command/health.svg)

```
[![Health](https://phpackages.com/badges/wp-packagist-wp-cli-gdrive-command/health.svg)](https://phpackages.com/packages/wp-packagist-wp-cli-gdrive-command)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k18.5M386](/packages/wp-cli-wp-cli)[wp-cli/wp-cli-bundle

WP-CLI bundle package with default commands.

896.7M152](/packages/wp-cli-wp-cli-bundle)[wearerequired/wp-cli-clear-opcache

Use WP-CLI to clear the OPcache for a site via HTTP.

1736.4k](/packages/wearerequired-wp-cli-clear-opcache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
