{"id":15292231,"url":"https://github.com/wp-packagist/wp-cli-gdrive-command","last_synced_at":"2025-04-13T11:11:40.857Z","repository":{"id":57082148,"uuid":"184534597","full_name":"wp-packagist/wp-cli-gdrive-command","owner":"wp-packagist","description":"Google Drive Cloud Storage for WP-CLI","archived":false,"fork":false,"pushed_at":"2021-07-20T03:09:04.000Z","size":385,"stargazers_count":5,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T23:16:51.892Z","etag":null,"topics":["google","google-api","google-drive","wordpress","wp-cli","wp-cli-command","wp-cli-package"],"latest_commit_sha":null,"homepage":"https://wp-packagist.github.io/wp-cli-gdrive-command/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-packagist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-02T06:52:20.000Z","updated_at":"2022-12-02T13:46:05.000Z","dependencies_parsed_at":"2022-08-24T14:58:19.181Z","dependency_job_id":null,"html_url":"https://github.com/wp-packagist/wp-cli-gdrive-command","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-packagist%2Fwp-cli-gdrive-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-packagist%2Fwp-cli-gdrive-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-packagist%2Fwp-cli-gdrive-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-packagist%2Fwp-cli-gdrive-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-packagist","download_url":"https://codeload.github.com/wp-packagist/wp-cli-gdrive-command/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703198,"owners_count":21148118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-api","google-drive","wordpress","wp-cli","wp-cli-command","wp-cli-package"],"created_at":"2024-09-30T16:17:01.702Z","updated_at":"2025-04-13T11:11:40.830Z","avatar_url":"https://github.com/wp-packagist.png","language":"PHP","readme":"# WP-CLI Google Drive Command\r\n\r\nUse Google Drive Storage in WordPress WP-CLI Command line for Backup/Restore Files.\r\n\r\n[![Build Status](https://travis-ci.com/wp-packagist/wp-cli-gdrive-command.svg?branch=master)](https://travis-ci.com/wp-packagist/wp-cli-gdrive-command)\r\n![GitHub](https://img.shields.io/github/license/wp-packagist/wp-cli-gdrive-command.svg)\r\n![GitHub repo size](https://img.shields.io/github/repo-size/wp-packagist/wp-cli-gdrive-command.svg)\r\n![GitHub release](https://img.shields.io/github/release/wp-packagist/wp-cli-gdrive-command.svg?style=social)\r\n\r\n\u003cbr\u003e\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/logo.png\" alt=\"WP-CLI Google Drive\"\u003e\r\n\u003c/p\u003e\r\n\r\n- [WP-CLI Google Drive Command](#wp-cli-google-drive-command)\r\n  * [Installation](#installation)\r\n    + [Authenticate Users](#authenticate-users)\r\n  * [Structure](#structure)\r\n  * [Commands](#commands)\r\n    + [List of files and folder](#list-of-files-and-folder)\r\n    + [Create folder in Google Drive](#create-folder-in-google-drive)\r\n      - [Nested Directory](#nested-directory)\r\n    + [Download File](#download-file)\r\n      - [Auto Extract after download](#auto-extract-after-download)\r\n    + [Copy files or Folder](#copy-files-or-folder)\r\n    + [Move files or Folder](#move-files-or-folder)\r\n    + [Remove Files or folder](#remove-files-or-folder)\r\n    + [Rename a file or folder](#rename-a-file-or-folder)\r\n    + [Get Share Link For a files or folder](#get-share-link-for-a-files-or-folder)\r\n    + [Private a files or folder](#private-a-files-or-folder)\r\n    + [List of files and folder in trash](#list-of-files-and-folder-in-trash)\r\n      - [Clear all files in trash](#clear-all-files-in-trash)\r\n    + [Restore Files or folder](#restore-files-or-folder)\r\n    + [Get Your Storage](#get-your-storage)\r\n    + [Upload Files or Folder](#upload-files-or-folder)\r\n  * [Author](#author)\r\n  * [Contributing](#contributing)\r\n  \r\n  \r\n## Installation\r\n\r\nyou can install this package with:\r\n\r\n```console\r\nwp package install wp-packagist/wp-cli-gdrive-command\r\n```\r\n\r\n\u003e Installing this package requires WP-CLI v2 or greater. Update to the latest stable release with `wp cli update`.\r\n\r\n### Authenticate Users\r\n\r\nStep 1: Go to [Google Developers console](https://console.developers.google.com/) and Create a new project\r\n\r\n\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-1.jpg\" alt=\"Create new Project in Google Console\"\u003e\r\n \u003cbr\u003e\r\n\u003c/p\u003e\r\n \r\n Step 2: Create an OAuth client ID\r\n \r\n \u003cp align=\"center\"\u003e\r\n \u003cimg src=\"https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-2.jpg\" alt=\"OAuth client ID in Google developer\"\u003e\r\n \u003cbr\u003e\r\n \u003c/p\u003e\r\n \r\nYou can select Other types for the project.\r\n \r\n  \u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-3.jpg\" alt=\"OAuth client ID in Google developer\"\u003e\r\n \u003cbr\u003e\r\n  \u003c/p\u003e\r\n  \r\n  Then copy your Client Id and Client secret.\r\n  \r\n   \u003cp align=\"center\"\u003e\r\n    \u003cimg src=\"https://raw.githubusercontent.com/wp-packagist/wp-cli-gdrive-command/master/screenshot/step-4.jpg\" alt=\"Get Client Id and Client Secret\"\u003e\r\n \u003cbr\u003e\r\n    \u003c/p\u003e\r\n  \r\n  Step3 : run command and enter your Client id and Client secret.\r\n  \r\n  ```console\r\n  wp gdrive auth\r\n  ```\r\n  \r\n  \u003e if you want change gmail account that saved before. use 'wp gdrive auth --force'.\r\n\r\n## Structure\r\n\r\n```\r\nNAME\r\n\r\n  wp gdrive\r\n\r\nDESCRIPTION\r\n\r\n  Google Drive Cloud Storage.\r\n\r\nSYNOPSIS\r\n\r\n  wp gdrive \u003ccommand\u003e\r\n\r\nSUBCOMMANDS\r\n\r\n  auth         Verify user identity on Google.\r\n  copy         Copy a file or folder.\r\n  get          Download a file.\r\n  ls           List of files and folder.\r\n  mkdir        Create folder in Google Drive.\r\n  move         Move a file or folder.\r\n  private      Private a file or folder.\r\n  rename       Rename a file or folder.\r\n  restore      Restore a file and folder from trash.\r\n  rm           Remove File or folder By Path.\r\n  share        Get Download Link a file or folder.\r\n  storage      Verify user identity on Google.\r\n  trash        List of files and folder in trash.\r\n  upload       Upload a file.\r\n```\r\n\r\n## Commands\r\n\r\nList of WP-CLI gdrive Commands :\r\n\r\n### List of files and folder\r\n\r\nFor show list all files and folder in root dir :\r\n\r\n```console\r\nwp gdrive ls\r\n```\r\n\r\nFor show list of files from custom path e.g /wordpress/backup \r\n\r\n```console\r\nwp gdrive ls /wordpress/backup\r\n```\r\n\r\n### Create a folder in Google Drive\r\n\r\nFor creating  a folder use :\r\n\r\n```console\r\nwp gdrive mkdir \u003cpath\u003e\r\n```\r\n\r\ncreate `backup` folder in the root directory:\r\n\r\n```console\r\nwp gdrive mkdir backup\r\n```\r\n\r\n#### Nested Directory\r\n\r\nyou can also create nested dir. for example:\r\n\r\n```console\r\nwp gdrive mkdir wordpress/new-project/backup\r\n```\r\n\r\n### Download File\r\n\r\n```console\r\nwp gdrive get \u003cpath\u003e \u003csave-to\u003e [--name=new_name] [--e]\r\n```\r\n\r\nDownload backup.zip file from root dir in Google Drive:\r\n\r\n```console\r\nwp gdrive get backup.zip\r\n```\r\n\r\nDownload backup.zip file and save to custom dir with `package.zip` name:\r\n\r\n```console\r\nwp gdrive get backup.zip /folder/ --name=package.zip\r\n```\r\n\r\n#### Auto Extract after download\r\n\r\nAutomatic unzip file after download: (use --e flag)\r\nDownload Backup.zip file and extract to /folder/.\r\n\r\n```console\r\nwp gdrive get backup.zip /folder/ --e\r\n```\r\n\r\n### Copy files or Folder\r\n\r\n```console\r\nwp gdrive copy \u003cpath\u003e \u003cnew-path\u003e\r\n```\r\n\r\n\u003e `new-path` is only new dir path.\r\n\r\nfor example copy file:\r\n\r\n```console\r\nwp gdrive copy /backup/wp.zip /folder/custom/\r\n```\r\n\r\nor copy folder:\r\n\r\n```console\r\nwp gdrive copy /folder/name/ /custom\r\n```\r\n\r\n### Move files or Folder\r\n\r\n```console\r\nwp gdrive mv \u003cpath\u003e \u003cnew-path\u003e\r\n```\r\n\r\nor\r\n\r\n```console\r\nwp gdrive move \u003cpath\u003e \u003cnew-path\u003e\r\n```\r\n\r\nFor example:\r\n\r\n```console\r\nwp gdrive move /folder/wordpress.zip /folder/custom/\r\n```\r\n\r\n### Remove Files or folder\r\n\r\n```console\r\nwp gdrive rm \u003cpath\u003e [--trash] [--force]\r\n```\r\n\r\nor\r\n\r\n```console\r\nwp gdrive remove \u003cpath\u003e [--trash] [--force]\r\n```\r\n\r\nPath: files or folder path e.g. /backup/wp.zip\r\n--trash: Move file to trash.\r\n--force: Force removing file and folder without question.\r\n\r\nFor example remove wordpress.zip file in root directory and move to trash:\r\n\r\n```console\r\nwp gdrive rm wordpress.zip --trash\r\n```\r\n\r\n### Rename a file or folder\r\n\r\n```console\r\nwp gdrive ren \u003cpath\u003e \u003cnew-name\u003e\r\n```\r\n\r\nor\r\n\r\n```console\r\nwp gdrive rename \u003cpath\u003e \u003cnew-name\u003e\r\n```\r\n\r\nFor example, rename wp.zip files that stored in backup folder to wordpress.zip:\r\n\r\n```console\r\nwp gdrive ren /backup/wp.zip wordpress.zip\r\n```\r\n\r\nRename a folder:\r\n\r\n```console\r\nwp gdrive ren /folder/folder/ new_folder_name\r\n```\r\n\r\n### Get Share Link For a files or folder\r\n\r\nIf you want to share files or folder and get public link use:\r\n\r\n```console\r\nwp gdrive share \u003cpath\u003e\r\n```\r\n\r\nfor example, get download link /backup/wp.zip file:\r\n\r\n```console\r\nwp gdrive share /backup/wp.zip\r\n```\r\n\r\n### Private a files or folder\r\n\r\nafter download files or folder by others, you can private again file or folder:\r\n\r\n```console\r\nwp gdrive private \u003cpath\u003e\r\n```\r\n\r\nfor example, disable download link /backup/wp.zip file:\r\n\r\n```console\r\nwp gdrive private /backup/wp.zip\r\n```\r\n\r\n### List of files and folder in the trash\r\n\r\nFor showing list of all files and folders in Google Drive Trash:\r\n\r\n```console\r\nwp gdrive trash\r\n```\r\n\r\n#### Clear all files in the trash\r\n\r\n```console\r\nwp gdrive trash --clear\r\n```\r\n\r\n### Restore Files or folder\r\n\r\nUse this command:\r\n\r\n```console\r\nwp gdrive restore \u003cpath\u003e\r\n```\r\n\r\nfor example, restore `backup` folder from Google drive trash:\r\n\r\n```console\r\nwp gdrive restore /backup/\r\n```\r\n\r\n### Get Your Storage\r\n\r\nFor getting your Storage:\r\n\r\n```console\r\nwp gdrive storage\r\n```\r\n\r\nor\r\n\r\n```console\r\nwp gdrive about\r\n```\r\n\r\n### Upload Files or Folder\r\n\r\n```console\r\n wp gdrive upload [\u003cpath\u003e] [\u003cUploadTo\u003e] [--name=\u003cfile_name\u003e] [--zip] [--force]\r\n```\r\n\r\npath\r\n : The path of file or folder for Upload. `default is current path`\r\n \r\nUploadTo\r\n: The path dir where the file will be saved in Google Drive.\r\n\r\n--name\r\n: New file name to save.\r\n\r\n--zip\r\n: Create Zip file before uploading.\r\n\r\n--force\r\n: Force upload even if it already exists.\r\n\r\n---\r\n\r\nAutomatic create zip file archive file from all root directory and files and upload to GDrive:\r\n\r\n```console\r\nwp gdrive upload --zip\r\n```\r\n\r\nUpload backup.zip file to root dir in Google Drive:\r\n\r\n```console\r\nwp gdrive upload backup.zip\r\n```\r\n\r\nAutomatic create zip archive from the /wp-content/ folder and upload to custom dir:\r\n\r\n```console\r\nwp gdrive upload /wp-content/ /wordpress/backup --zip\r\n```\r\n\r\nUpload All files from `/wp-content/plugins/my-plugin/docs` to `wordpress/plugin` directory in Google Drive\r\n\r\n```console\r\nwp gdrive upload /wp-content/plugins/my-plugin/docs/ /wordpress/plugin --zip\r\n```\r\n\r\n\u003e Number Max files in One Request is 100 files\r\n\r\n\r\nUpload with a custom name.\r\n\r\n```console\r\nwp gdrive upload backup.zip --name=wordpress.zip\r\n```\r\n\r\nGet Backup From WordPress Database and Upload to Google Drive:\r\n\r\n```console\r\nwp db export backup.sql\r\nwp gdrive upload backup.sql /backup/wordpress\r\n```\r\n\r\n## Author\r\n\r\n- [Mehrshad Darzi](https://www.linkedin.com/in/mehrshaddarzi/) | PHP Full Stack and WordPress Expert\r\n\r\n## Contributing\r\n\r\nWe appreciate you taking the initiative to contribute to this project.\r\n\r\nContributing 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.\r\n\r\n### Reporting a bug\r\n\r\nThink you’ve found a bug? We’d love for you to help us get it fixed.\r\nBefore 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.\r\n\r\n### Creating a pull request\r\n\r\nWant 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.\r\n\r\nOnce 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:\r\n\r\n1. Create a feature branch for each contribution.\r\n2. Submit your pull request early for feedback.\r\n3. Follow [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/).\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-packagist%2Fwp-cli-gdrive-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-packagist%2Fwp-cli-gdrive-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-packagist%2Fwp-cli-gdrive-command/lists"}