google drive show size folder

How to Check the Size of a Folder in Google Drive

Google Drive is a cloud storage service that allows users to store and share files and folders online. Checking the size of a folder in Google Drive can be helpful for managing your storage space and organizing your files. Here are the steps to check the size of a folder in Google Drive:

Method 1: Using Google Drive Web Version

  1. Open your web browser and go to https://drive.google.com.
  2. Log in to your Google account if you haven't already.
  3. Navigate to the folder whose size you want to check.
  4. Right-click on the folder and select "Get Info".
  5. A pop-up window will appear showing the size of the folder and its contents.

Method 2: Using Google Drive Desktop App

  1. Download and install the Google Drive desktop app on your computer.
  2. Sign in to your Google account.
  3. Open the Google Drive folder on your computer.
  4. Find the folder whose size you want to check.
  5. Right-click on the folder and select "Properties".
  6. A pop-up window will appear showing the size of the folder and its contents.

Method 3: Using Google Drive API

If you are a developer, you can use the Google Drive API to retrieve the size of a folder programmatically. Here is an example code snippet in Python:


import os
from google.oauth2 import service_account
from googleapiclient.discovery import build

# Replace with your own service account credentials
SERVICE_ACCOUNT_FILE = 'path/to/your/service/account.json'
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly']

# Authenticate with the Google Drive API using service account credentials
creds = None
creds = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = build('drive', 'v3', credentials=creds)

# Replace with the ID of the folder you want to check
folder_id = 'your-folder-id'

# Call the Google Drive API to retrieve the folder metadata
folder = service.files().get(fileId=folder_id, fields='size').execute()

# Print the size of the folder in bytes
print("Folder Size: {} bytes".format(folder['size']))

Before running the code, you need to replace the SERVICE_ACCOUNT_FILE variable with the path to your own service account credentials file, and the folder_id variable with the ID of the folder you want to check. Once you run the code, it will print the size of the folder in bytes.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe