0

You can look up file sizes on Google drive but it does not show the size of the whole folder.

I've been looking for ways to get the size of a folder on Google Drive but couldn't find any.

Is there any way to see how much space a folder has taken on Google Drive?

5
  • 2
    Does this answer your question? How to view the folder size in Google Drive?
    – Rubén
    Sep 10 '20 at 17:04
  • @Rubén Nope it doesn't.
    – Aditya
    Sep 10 '20 at 17:16
  • I've posted an answer below, that worked for me!
    – Aditya
    Sep 10 '20 at 17:19
  • Post the answer in the referred question. There is a 500 bounty that expires in 2 days!!
    – Rubén
    Sep 10 '20 at 17:24
  • 1
    I don't have the required reputation!
    – Aditya
    Sep 11 '20 at 6:33
6

One approach to this is using Google Colab.

Step 1: Visit Google Colab and create a new python 3 notebook.

Step 2: Mount drive by running this code in a cell:

from google.colab import drive
drive.mount('/content/drive')

This will provide you an url to obtain an authorization code, which you will need to provide in a box.

Step 3: run this code in the cell: (replace folder-name with any folder in your drive)

! du -sh /content/drive/My\ Drive/<folder-name>

For example, to get the total size of the /content/drive/My\ Drive/dataset directory, you would run the following command:

! du -sh /content/drive/My\ Drive/dataset

Output:
3.4G    /content/drive/My Drive/dataset

if you want to display the disk usage of the first-level subdirectories, run:

! du -sh /content/drive/My\ Drive/dataset/*

Output:
24K     /dataset/db
3.3G    /dataset/lib
4.0K    /dataset/local
108.0M  /dataset/lock
856.0M  /dataset/log

For more details on du command, visit: https://linuxize.com/post/how-get-size-of-file-directory-linux/

9
  • /dataset didn't work for me. taking it out seem to work... the first 2 steps are quite confusing from my brief experience now trying to replicate them. waiting for at least 15 minutes for the task to complete or even reach any folder to show up.
    – cregox
    Sep 12 '20 at 16:59
  • 1
    well, it worked! now i hope we can find out a way to properly redirect the reward...
    – cregox
    Sep 12 '20 at 20:25
  • big caveat: it'll consider all kinds of files, regardless if it's counting against the quota or not. i don't think there's any way around it.
    – cregox
    Sep 12 '20 at 21:44
  • 1
    this is my favourite one liner, so far: ! cd /content/drive/My\ Drive/ ; du --apparent-size -csh * | sort -rh
    – cregox
    Sep 13 '20 at 8:25
  • Well, /content/drive/My\ Drive/ gives you access to the root folder of your drive.
    – Aditya
    Sep 15 '20 at 11:12
2

I was also looking for way to list folder and file sizes so that I can do clean up on my G Drive. I actually found quite an accurate way of doing it.

  • Download and install Drive File Stream from Google
  • After installation, sign into your Google account using the Drive File Stream app.
  • It'll add your Google Drive as a drive on your PC enter image description here
  • Download and install WinDirStat
  • Open WinDirStat and then select the Google Drive added by Drive File Stream
  • Scan the drive and viola. It even shows the date and time of the last change enter image description here

(Credits go to this guy for introducing me to Drive File Stream: https://support.google.com/drive/thread/3970069?hl=en&msgid=86820802)

1
  • That is great! I have linked this answer under the question for which this was marked as duplicate and closed. If you want to post an answer there too, flag me and I'll delete mine.
    – cipricus
    May 31 at 11:39

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