Giter Club home page Giter Club logo

gdrive-backup-perl's Introduction

gdrive-perl-backup

Purpose

Mostly just to play with the Google Drive API in Perl, because they don't seem to have any docs.

Usage

Get a Google Drive API key, you can't have mine! Visit https://code.google.com/apis/console/b/0/ to get set up.

Put your client secret and client name into gdrive_backup.pl.

Generate an OAuth token by running: perl create_token.pl

You'll need to visit the redirect URL in your browser, confirm the app and copy the confirmation string back into the script. The token will be tested out and serialized to a file (oauth.tok by default). Make sure the output file is stored safely, don't put it some place public.

Now you can push files to Google Drive with: perl gdrive_backup.pl -d 'Backed Up Doc' -f 'sample_file.txt'. The best use I can think of is to schedule backups with cron.

Notes

  • I've thrown in a modified version of Net::OAuth. I couldn't get the CPAN version to coerce the hashes Google returned correctly. I may be doing things wrong, let me know.

  • You can replace any existing file by using it's name as the -d flag. If you run the same command multiple times, each upload will be a new version of the last.

  • By default the MIME type is 'text/plain', and we ask Google Docs to convert to their own format. You can change the MIME type by using the -t field. Formats like text, CSV and xls will be viewable in the browser if you set the MIME type properly.

License

Can be found in LICENSE, it's just BSD. Go wild.

gdrive-backup-perl's People

Contributors

yanick avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.