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
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
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/*
For more details on du command, visit: https://linuxize.com/post/how-get-size-of-file-directory-linux/
drive.mount has been changed to