This article will discuss how to identify empty folders in Google Drive.
Table Of Contents
Identify empty folders in Google Drive
The best way to do this is, via a script. Say you must find the empty folders and then delete them. You can follow the below steps.
- Open Google sheet.
- Click on the Tools menu –> Then click on the Script editor as highlighted below.

3. In the code editor window paste the below code.
function deeteEmptyFolders() {
var myfolders = DriveApp.getFolders();
var xy = SpreadsheetApp.create("FolderDetails");
while (myfolders.hasNext()) {
var folder = myfolders.next();
var myfiles = folder.getFiles();
var childfolders = folder.getFolders();
var filecount = 0;
var foldercount = 0;
while (childfolders.hasNext()){
var childfolder = childfolders.next();
foldercount ++;
}
while (myfiles.hasNext()){
var file = myfiles.next();
filecount ++;
}
xy.appendRow([folder.getId(),folder.getName(),filecount, foldercount]);
if (filecount == 0 && foldercount == 0){
folder.setTrashed(true);
}
}
}4. Click the Save button and then the Run button as highlighted below.

5. Now, you will get the expected output.

You may also like following the articles below
Wrapping Up
In this article, we discussed the quick ways to identify empty folders in Google Drive. Thanks for reading this article !!!

I am Rajkishore, and I have over 14 years of experience in the Software Industry. For a long time, I have been using Google Docs, Google Drive, and Google Sheets for my document usage, and I am sharing all the tips and tricks, the challenges I have come across, and their solutions to use Google Docs for your day-to-day use. I hope you will learn from these practical Google Docs tutorials. Read more.