3

According to the Google Drive SDK, the size and MD5 hash of files is available through the API. Each resource (file) has an md5Checksum and a fileSize:

md5Checksum (string): An MD5 checksum for the content of this file. This is populated only for files with content stored in Drive.

fileSize (long): The size of the file in bytes. This is populated only for files with content stored in Drive.

How can I access them through Google's web interface? I'd like to avoid coding my own interface just for this.

1

2 Answers 2

2

There seem to be no way through Google Drive's interface (yet), however for a quick manual way you can use Google OAuth 2.0 Playground to call the Drive APIs List Files service and get the md5Checksum. I needed this to verify that some personal large file I uploaded got there properly, hence the answer is not exactly tailored for development purposes.

0

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,+size)
//

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,+size
//

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);
3
  • Perhaps you missed the part where the Asker said: "How can I access them through Google's web interface? I'd like to avoid coding my own interface just for this."
    – ale
    Mar 1, 2018 at 14:13
  • This is a decent enough method for me since I don't have to create any files or install pip packages, but the q parameter was giving me a bit of trouble, probably since a novice like doesn't know how to extract the ID of a folder. However, going by the documentation, I replaced it with corpora=user to simply list all my files, and I could just search through the JSON output. Apr 26, 2021 at 23:43
  • 1
    @Varad Mahashabde, The folder ID is in the address bar. Looks like this https://drive.google.com/drive/folders/0123456789abcdefABCDEF012345. The 0123456789abcdefABCDEF012345 would be the folder ID.
    – XP1
    May 11, 2021 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.