How to check folder size in Google Drive


One approach to this is using Google Colab.

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

Step 2: Mount drive

mount drive

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/