Question

I'm not a programmer, just a regular user of Google Drive. I want to see if the files are uploaded correctly. I go through a whole process in the OAuth 2.0 Playground that lists all files, shows the MD5 checksums but also lots of information per file. If I upload a new file it's hard to search for it and verify its md5 checksum.

Is there an easier way (through an app, maybe?) to show/list MD5 checksums for the uploaded files? I wonder why the Details pane doesn't have it, only lists the file size in bytes.

Was it helpful?

Solution

edit: NB these instructions have changed slightly for the v3 API

I've figured out a quick way to get the MD5 checksums of the files uploaded and decided to share it here, too. Log into your Google Drive account, then:

Visit: https://developers.google.com/drive/v3/reference/files/list

Scroll down to the Try it! section.

Change "Authorize requests using OAuth 2.0" from OFF to ON by clicking on it, then select:

https://www.googleapis.com/auth/drive.metadata.readonly

and click Authorize.

Choose your account then click Accept.

Fill in the fields field with:

for v2 API:

items(md5Checksum,originalFilename)

for v3 API:

open "Show standard parameters" in GUI to see fields than

files(md5Checksum,originalFilename)

to only get a list of filenames and MD5 checksums.

Click Execute and you'll open a list with all the files uploaded to Google Drive and their MD5 checksums.

OTHER TIPS

API instructions

Google Developers - OAuth 2.0 Playground:

Step 1: Select & authorize APIs:

Step 2: Exchange authorization code for tokens:

  • Click "Exchange authorization code for tokens".

Step 3: Configure request to API:

  • Enter the "Request URI".
  • Click "Send the request".

Request URI instructions

All files in folder

Get specific fields of files in a folder:

https://www.googleapis.com/drive/v3/files?q="folderId"+in+parents&fields=files(md5Checksum,+originalFilename)
//

Replace "folderId" with the folder ID.

You can use &fields=files(*) to get all of the file's fields.

Single file

Get specific fields of a file:

https://www.googleapis.com/drive/v3/files/fileId?fields=md5Checksum,+originalFilename
//

Replace "fileId" with the file ID.

You can use &fields=* to get all of the file's fields.

Parsing the JSON response

  • Open a JavaScript console.
  • Save the object into a variable.
  • Map the object.
  • Copy the result.

Code

var response = {
  "files": [
    {
      "md5Checksum": "0cc175b9c0f1b6a831c399e269772661", 
      "originalFilename": "a.txt"
    }, 
    {
      "md5Checksum": "92eb5ffee6ae2fec3ad71c777531578f", 
      "originalFilename": "b.txt"
    }
  ]
};


var result = response.files.map(function (file) { return (file.md5Checksum + " *" + file.originalFilename); }).join("\r\n");

console.log(result);
copy(result);

Here are three additional, different ways to list md5 checksums.

  1. Install Google Skicka, a command line tool for Google Drive and run skicka ls -ll / Although the readme file says it's not an official google product it is hosted on google's github account, so I guess it can be trusted.
  2. There is a plugin that lists all files with their checksums in drive's spreadsheet.
  3. Here's my python3 script that I've created for myself. It's mostly copied from google's official examples. You'll need to obtain client_secret.json file and place it in the same directory with the script - here's the instruction how to do it.

Based on: Alex's above answer!

  1. Click the link : https://developers.google.com/drive/v3/reference/files/list

  2. Click the Try it now link in the middle.

    ( An active window appears in the middle )

  3. Scroll down the left pane in the active window.

  4. Under fields section on the left pane, fill

    files(md5Checksum,originalFilename)

  5. Now we will limit access scopes :

    (i) leave the Google OAuth 2.0 selected & clear the box against API key.

    (ii) Expand Show scopes under Google OAuth 2.0

    (iii) Clear all the scopes but keep this one selected:

     **https: //www.googleapis.com/auth/drive.metadata.readonly**
    
  6. Now click EXECUTE in blue.

    (A new Google Sign In Window will open)

  7. Use that window to Sign in with the respective google account & click Allow to permit the Google APIs Explorer access files in your google drive.

    It's done! A new window will open with the results in lower right code pane. It will provide the names & md5Checksums for all the files in the respective google drive account.

  8. Click outside of the active window to close the window & close the Google Drive API tab. Now you can sign out of the google account if you want!

Combined with XP1 and Alex guides to work in my scenario, to list MD5 for private folders that shared with me

-includeItemsFromAllDrives -includeTeamDriveItems -supportsAllDrives -supportsTeamDrives

Request URI in OAuth 2.0 Playground

https://www.googleapis.com/drive/v3/files?q="folderID"+in+parents&includeItemsFromAllDrives=true&includeTeamDriveItems=true&supportsAllDrives=true&supportsTeamDrives=true&fields=files(md5Checksum%2CoriginalFilename)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top