A simple nodejs script for performing basic actions in google drive.
bgdrive --help
git clone https://github.com/OpenDevEd/bgdrive.git
cd bgdrive
npm run setup
bgdrive --help
Note: This requires setting up of
~/.config/Bgdrive/credentials.json
The script has links to the API docs in it.
Follow these steps to get your Google Credentials for Google Drive API:
First, navigate to the Google Cloud Console.
Click on the "Select a project" dropdown, then click on "NEW PROJECT". Give your project a name and click "CREATE".
In the Dashboard, click on "ENABLE APIS AND SERVICES". Search for "Google Drive API" and click on it. Then click "ENABLE".
Go back to the Dashboard and click on "Credentials" in the left-hand menu. Click on "CREATE CREDENTIALS" and select "OAuth client ID".
You'll be asked to configure the OAuth consent screen. Fill in the necessary details and click "SAVE".
Select "Web application" as the Application type. Give it a name and add your redirect URIs, then click "CREATE".
You'll see a screen with your client ID and client secret. Click on the download icon to download your credentials in a JSON file.
And that's it! You now have your Google Credentials for Google Drive API.
When you first run bgdrive
, you'll need to log in. bgdrive
presents you with a link, which you open. Once you have signed in, you'll get a redirect to 'localhost' (which won't work). However, you can read off the code from that url. Paste that code into the terminal as prompted.
You're now ready to use bgdrive
!
-V, --version
: Displays the version number of BGDrive.-d, --debug
: Enables debug mode.-h, --help
: Displays help for the command.
download <source...>
: Downloads gdrive file(s) in the given format(s).move [options] <source...>
: Moves gdrive file(s) to the folder with the specified ID.shortcut [options] <source...>
: Creates shortcuts for gdrive file(s) in the folder with the specified ID.wormhole [options] <source...>
: Creates shortcuts for gdrive folders in the specified folders.copy [options] <source...>
: Copies the gdrive file(s) and moves them to the folder with the specified ID.newfolder [options] <name...>
: Creates folders on gdrive.upload [options] <path...>
: Uploads files to gdrive.get [options]
: Retrieves files from Google Drive.help [command]
: Displays help for the specified command.sheet [options]
: Retrieve and set cells/ranges within Google Sheetsreplicate [options]
: Replicate a folder structure