First, we need to obtain our oauth credentials, here’s how to do it:
Now, we have obtained our credentials, move to the First run section to use those credentials:
If you cannot see the project, please try to access to https://console.cloud.google.com/cloud-resource-manager.
You can also create new project at there. When you create a new project there, please click the left of “Google Cloud Platform”. You can see it like 3 horizontal lines.
By this, a side bar is opened. At there, select “API & Services” -> “Library”. After this, follow the below steps:
Go back to oauth credentials setup
On first run, the script asks for all the required credentials, which we have obtained in the previous section.
Execute the script: gupload filename
Now, it will ask for following credentials:
Client ID: Copy and paste from credentials.json
Client Secret: Copy and paste from credentials.json
Refresh Token: If you have previously generated a refresh token authenticated to your account, then enter it, otherwise leave blank. If you don’t have refresh token, script outputs a URL on the terminal script, open that url in a web browser and tap on allow. Copy the code and paste in the terminal.
Root Folder: Gdrive folder url/id from your account which you want to set as root folder. You can leave it blank and it takes root
folder as default.
If everything went fine, all the required credentials have been set, read the next section on how to upload a file/folder.