Download an upload large files to Google Drive (API v3)

Overview

gdriver

Build Status

gdriver is a command-line tool, written in Go, used for uploading and downloading large personal files from Google Drive (API v3). The tool provides file selection, integrity checks, transfer retries and requires a user-defined Cloud Platform project.

Click on the image to open a screencast:

asciicast

Features

  • Uses Google Drive v3 API
  • TUI-based file selection
  • File integrity check (MD5 checksum)
  • Transfer retries (app-internal and on application restart)
  • OAuth 2.0 authorization protocol

Requirements

  • User-defined Cloud Platform project with enabled Drive API (Quickstart)

Getting started

If you have installed Go SDK, you can download and build the latest master of the gdriver binary:

go get github.com/mtojek/gdriver

Without Go SDK you can download prebuilt distribution from the Releases page. If you're working on a remote workstation, copy the URL link for particular release, use curl or wget to download the archive and unpack it later (e.g tar xvzf gdriver_X.Y.Z_linux_amd64.tar.gz).

Run the help command to see available commands:

Use gdriver to download and upload large files to Google Drive.

Usage:
  gdriver [command]

Available Commands:
  auth        Authenticate Google account
  check       Check files
  download    Download files
  help        Help about any command
  upload      Upload files

Flags:
  -h, --help   help for gdriver

Use "gdriver [command] --help" for more information about a command.

Run the application for the first time

Import client configuration (credentials.json) for the Cloud Platform project. If you haven't created the project yet or enabled the Drive API, follow the Quickstart steps.

Hints:

  • Use a meaningful project name as it will be presented as title in the Google authentication form.
  • Select Desktop application type for the OAuth client.
  • There were issues reported in the past with downloading and saving the credentials file in Firefox. In case of facing a similar issue, please try to use Google Chrome.

Once you create the project, remember to download related login credentials.

The command will import the above credentials into the ~/.gdriver directory and authenticate the Google user account:

gdriver auth --import-credentials credentials.json

You should be good to go now. Try to download first files using the gdriver download command, e.g.:

gdriver download <folderID> --select --output tmp

The folderID is the ID of a Drive folder (e.g. Ax9h4tAyI53ZhqMSoa2opZ6o6m21OUyww). The value can be easily copied from the URL bar in the web browser. Open the directory in the Google Drive console and pick the folderID part from the URL (e.g. https://drive.google.com/drive/u/0/folders/Ax9h4tAyI53ZhqMSoa2opZ6o6m21OUyww).

Releases

Find latest revisions on the Releases page.

License

Apache License

Issues
  • About restricted files

    About restricted files

    Hello i really liked your server but i want to download some shared folder files but the thing is i cannot access the Anyone link. The files are restricted to specific users. Even if i have auth from the same id i cannot download them using your gdriver program what can i do please tell me. it gives this error

    Read folder metadata for "17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g"
    Error: downloading files failed: can't read folder metadata (ID: 17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g): googleapi: Error 404: File not found: 17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g., notFound
    
    opened by lordofwizard 6
  • didn't close resp.Body

    didn't close resp.Body

    Hi mtojek, I'm building something with the Google Drive API and wanted to see the idiomatic way to download a file, when I stumbled upon this project. If I'm not mistaken, then you forgot to close the resp.Body in downloadFileData(), which leds to a resource leak. More specificially, the connection isn't reused and thus the file descriptor isn't freed.

    If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request. more

    To fix this, add defer resp.Body.Close() after you check the error of ...Download(). Have a nice day! :)

    opened by liamvdv 2
  • Question: About quota limits

    Question: About quota limits

    I have a 145TB Google Drive account with lots of videos which is accessed frequently and always maxes out daily bandwidth.

    Using this utility, through the Drive API, will I have any limits regarding quotas per day and the amount of downloads I can do? The fact that the Google Drive account, web version, runs out of bandwidth for a while, will not affect the use of this tool?

    opened by felinto-dev 0
Releases(v0.2.0)
Owner
Marcin Tojek
Marcin Tojek
Go program for uploading files to Google Drive

gdrive-upload Go program for uploading files to Google Drive. Installation Install Go Homebrew: sudo brew install go apt-get: sudo apt-get install gol

Ronan D'Souza 1 Nov 13, 2021
Utility for working with files and folders stored on Google Drive

skicka Utility for working with files and folders stored on Google Drive. Note: skicka is not an official Google product! Intro skicka makes it easy t

null 0 Nov 15, 2021
Provide an upload endpoint that stores files on pinata and returns a json response with the uploaded file pinata url

Purpose Build a template repository to get to coding as quickly as possible, by starting from a common template which follows the guidelines here Feat

Dathan Vance Pattishall 0 Dec 30, 2021
Compute message digest for large files in Go

checksum test coverage Compute message digest, like MD5 and SHA256, in golang for potentially large files. Usage package main import ( "fmt" "githu

Jerry Zhao 67 Aug 11, 2022
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).

中文 English 愿景:为用户提供最简单、可靠、高效的分布式文件系统。 go-fastdfs是一个基于http协议的分布式文件系统,它基于大道至简的设计理念,一切从简设计,使得它的运维及扩展变得更加简单,它具有高性能、高可靠、无中心、免维护等优点。 大家担心的是这么简单的文件系统,靠不靠谱,可不

小张 3.2k Aug 11, 2022
Plik is a scalable & friendly temporary file upload system ( wetransfer like ) in golang.

Want to chat with us ? Telegram channel : https://t.me/plik_root_gg Plik Plik is a scalable & friendly temporary file upload system ( wetransfer like

root.gg 1k Aug 10, 2022
A simply upload fileserver for fun

Filebus A simply upload fileserver for fun Build Binary: go build -o filebus . Docker docker build . -t n0vad3v/filebus:lastest Usage Filebus will b

Nova Kwok 0 Dec 14, 2021
Upgit - Upgit helps you simply upload any file to your Github repository and then get a raw URL for it

Upgit - Upgit helps you simply upload any file to your Github repository and then get a raw URL for it

null 281 Aug 2, 2022
FSManager - Tree view Simple util to displays the directory structure of a path or of the disk in a drive graphically.

FSManager - Tree view Simple util to displays the directory structure of a path or of the disk in a drive graphically. If you don't specify a drive or

Kostiantyn Denysov 1 Oct 9, 2021
Processing large file - go

not_yet_hit_the_wall Processing large file - go After reading Marcel Lanz's tweet (seems somebody liked it, and it was shown in my twitter's home), an

Radhika Isswandhana 10 Nov 18, 2021
Split text files into gzip files with x lines

hakgzsplit split lines of text into multiple gzip files

Luke Stephens (hakluke) 6 Jun 21, 2022
Easily create Go files from stub files

go-stubs Easily create .go files from stub files in your projects. Usage go get github.com/nwby/go-stubs Create a stub file: package stubs type {{.Mo

Sam Newby 4 Jan 27, 2022
app-services-go-linter plugin analyze source tree of Go files and validates the availability of i18n strings in *.toml files

app-services-go-linter app-services-go-linter plugin analyze source tree of Go files and validates the availability of i18n strings in *.toml files. A

Red Hat Developer 2 Nov 29, 2021
gsheet is a CLI tool (and Golang package) for piping csv data to and from Google Sheets

gsheet Table of Contents Introduction Why? Installation Authentication and Authorization What about OAuth authentication? CLI Usage Sheet commands Dri

chris 17 Jun 21, 2022
A command line tool for mainly exporting logbook records from Google Spreadsheet to PDF file in EASA format

Logbook CLI This is a command line tool for mainly exporting logbook records from Google Spreadsheet to PDF file in EASA format. It also supports rend

Vladimir Simakhin 0 Feb 6, 2022
A Docker-powered stateless API for PDF files.

Gotenberg provides a developer-friendly API to interact with powerful tools like Chromium and LibreOffice to convert many documents (HTML, Markdown, Word, Excel, etc.) to PDF, transform them, merge them, and more!

Gotenberg 3.9k Aug 11, 2022
copy files for humans

Go-Decent-Copy go-decent-copy provides a copy file for humans Usage package main import "github.com/hugocarreira/go-decent-copy" func main() { e

Hugo Carreira 16 Mar 5, 2022
Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)

go-exiftool go-exiftool is a golang library that wraps ExifTool. ExifTool's purpose is to extract as much metadata as possible (EXIF, IPTC, XMP, GPS,

null 130 Aug 8, 2022