How to Batch Delete All Empty Folders in Outlook [2024]

Written By Farhan Bin Matin

Folders in Microsoft Outlook facilitate organizing your workspace. So it occurs that you may create many folders, and some of them are left untouched.

Eventually, you need to remove those surplus folders. Wouldn’t it be wonderful if you could delete the blank folders in one go instead of one at a time?how-to-batch-delete-all-empty-folders-in-outlook

I will shed light on the easiest method to erase multiple folders instantly in this article.

Without further due, let’s begin.

Here is the easiest guide to add emojis in Outlook.

How to Batch Delete All Empty Folders in Outlook

Deleting empty folders all at once is surprisingly simple, yet most users find it puzzling. This simple method can clean the overgrown vacant folders in outlook.

It will work for almost all versions of Outlook, whether 2010/2013/2019/2016 or older.

Here is the best method to batch delete empty folders in Outlook:

You can delete all the empty folders with the VBA code.

Sounds cryptic? Don’t panic!

You don’t have to learn to code for that. Just copy and paste a code snippet into the VBA window.
I clean the empty folders and keep my outlook workspace tidy and composed with this method.

Here are steps to batch delete empty folders with VBA code:

  • Launch Outlook on your computer.
  • Press Alt + F11 key to open the VBA window. vba-module-outlook
  • Click on the Insert option from the top bar.
  • Select the Module option from the drop-down.
  • Paste the VBA code below inside the pop-up window. vba-command-run

Public Sub DeletindEmtpyFolder()

Dim xFolders As Folders

Dim xCount As Long

Dim xFlag As Boolean

Set xFolders = Application.GetNamespace(“MAPI”).PickFolder.Folders

Do

FolderPurge xFolders, xFlag, xCount

Loop Until (Not xFlag)

If xCount > 0 Then

MsgBox “Deleted ” & xCount & “(s) empty folders”, vbExclamation + vbOKOnly, “Kutools for Outlook”

Else

MsgBox “No empty folders found”, vbExclamation + vbOKOnly, “Kutools for Outlook”

End If

End Sub

Public Sub FolderPurge(xFolders, xFlag, xCount)

Dim I As Long

Dim xFldr As Folder ‘Declare sub folder objects

xFlag = False

If xFolders.Count > 0 Then

For I = xFolders.Count To 1 Step -1

Set xFldr = xFolders.Item(I)

If xFldr.Items.Count < 1 Then ‘If the folder is empty check for subfolders

If xFldr.Folders.Count < 1 Then ‘If the folder contains not sub folders confirm deletion

xFldr.Delete ‘Delete the folder

xFlag = True

xCount = xCount + 1

Else ‘Folder contains sub folders so confirm deletion

FolderPurge xFldr.Folders, xFlag, xCount

End If

Else ‘Folder contains items or (subfolders that may be empty).

FolderPurge xFldr.Folders, xFlag, xCount

End If

Next

End If

End Sub

  • Press the Run button or the F5 on your keyboard to execute the command. A new pop-up window will ask for the folders you want to delete.
  • Select the folders to delete. You can select multiple folders by keeping the left Ctrl button pressed while selecting. select-folder-outlook
  • Click OK.

A new confirmation pop-up window will show you how many folders have been deleted. Now, go back to the folder list, and you’ll see that there is no empty folder left.

Follow our guide step-by-step to add multiple emails to Outlook easily.

Ending Remarks

In Outlook, deleting empty folders in one stroke is kind of hidden. Unless you know the ins and outs of this application, it is quite difficult to figure out the multiple empty folder removal features.

That being said, I hope now you’ll have a great time with your favorite application.

About The Author
Farhan is a tech researcher and enthusiast. He’s been into tech and gaming since he got a PS2 in his childhood.Currently, he’s almost done with his undergrad.Besides testing and researching geeky stuff, Farhan has an utmost passion for photography.

Leave a Comment