Google Drive – How to View Number of Files in a Folder

google-apps-scriptgoogle-drive

I'm using the web version of Google Drive, which is not synced with any computer. I want to view the number of files inside this folder. There are hundreds of files in this folder, so scrolling through them is not an option. How would I be able to do this?

Best Answer

Use google colab to find the number of files in a folder

  1. Go to this notebook
  2. File -> Save a copy in Drive
  3. The new copy will open automatically
  4. Run the code blocks by selecting and pressing Shift+Enter
  5. Mount the google drive when you are prompted
  6. Change the value of variable FOLDER_PATH from labelled-dataset to your own folder name or path. For example you can change it to: 'my folder/category/sub folder'
  7. Now run this block with Shift+Enter, this will print the number of files in that folder

OR

Alternatively you can create a new colab notebook and run the following code while following only step 6 from above:

1. Mount Drive:

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

2. Count no. of files:

import os
FOLDER_PATH = 'labelled-dataset'
ROOT_PATH = '/content/drive/MyDrive/'
print(len(os.listdir(os.path.join(ROOT_PATH, FOLDER_PATH))))