Ever found yourself wishing you could manage your Google Drive files without clicking through a web browser? Maybe you're a developer, a sysadmin, or just someone who prefers the efficiency of the command line. If so, you've probably stumbled upon the 'drive' client, a powerful, albeit tiny, program designed to do just that: pull and push your Google Drive files.
It's easy to get started. The first hurdle, as with many command-line tools, is installation. The good news is that if you've got Go 1.9.x or higher installed, you're mostly there. You'll want to make sure your GOPATH is set up correctly in your environment variables – think .bashrc or .bash_profile. A quick export GOPATH=$HOME/gopath and export PATH=$GOPATH:$GOPATH/bin:$PATH followed by source ~/.bashrc (or opening a new terminal) should do the trick. This ensures that once compiled, the drive binary is accessible from anywhere in your terminal.
To grab the latest version directly from the source, a simple go get -u github.com/odeke-em/drive/cmd/drive should get you up and running. Now, if you're dealing with specific issues or need certain functionalities, the installation process can get a tad more nuanced. For instance, if you need to bundle debug information with the binary, you'll be running go get github.com/odeke-em/drive/drive-gen && drive-gen. And for those who need a specific binary, like for Debian systems, you might look into go get -u github.com/odeke-em/drive/drive-google.
Once installed, the real magic begins with initialization. Before you can start moving files around, you need to tell drive where to find your Google Drive on your local system. This is done with drive init. You can initialize it with your standard OAuth2 credentials by pointing it to a local directory, like drive init ~/gdrive, and then cd ~/gdrive. Alternatively, if you're working with service accounts (which is common for automated tasks), you can use drive init --service-account-file <gsa_json_file_path> ~/gdrive. This step is crucial; it establishes the connection and sets up the necessary configuration.
What can you actually do with it? The list is quite extensive. You can list files, print their contents, get their MD5 checksums, retrieve file IDs, check your quota, and even see what features are available. Pushing and pulling files is, of course, a core function. You can verify checksums during exports, and the client handles the complexities of syncing your local changes with the cloud.
Beyond basic file operations, drive offers features like end-to-end encryption for enhanced privacy, sharing and emailing files, starring or unstarring items, and even diffing files to see what's changed. Trashing and untrashing files, emptying the trash, and deleting are also supported, giving you full control over your cloud storage.
Interestingly, the client also helps you detect and fix clashes, manage .desktop files, and fetch or prune missing index files. It even has a drive server command, which can be useful for generating QR codes for sharing. And if you ever need to disconnect, drive deinit is your friend, removing credentials and configuration files.
Why bother with another Google Drive client? The project's history notes that 'drive' was initially developed by someone on the Google Drive team. While the original maintainer became busy, the project was taken over, ensuring its continued development. It aims to provide a lightweight, efficient way to interact with Google Drive, especially for those who live in their terminal. It's a testament to the power of open-source collaboration, offering a robust alternative for managing your digital life in the cloud.
