Permanently Delete Empty Folders in Outlook PST 2019/2016

Megha Sharma
Megha Sharma linkedin | Updated On - May 04, 2023 |

Read time 5 minutes

An Outlook database file (PST) holds the structural hierarchy of the mailbox and its folders. Some folders come inbuilt like Inbox, Sent Items, Draft, etc. while the users can create some. Over time, the database file grows in size as many emails are Sent and Received. They occupy the database file storage space, and so demand space management.

An Outlook user has different ways to manage the PST data by exporting it to other locations (system drive or different email/client destination), archiving file items, manually deleting, or migrating to some other platform. Before all these actions, it is good to remove all Empty Folders, sub-folders, etc. so as to eliminate unnecessary complications.

Empty Folders are a cause of annoyance. Besides consuming space, they create confusion and disappointment as no emails are found after accessing them. While trying to export items from the Outlook PST file, it would also move these empty folders, which is undesirable for Outlook users. The folders without any data or information are of no use in the new location. Let us find suitable ways to delete these empty folders permanently.

How to Permanently Delete Empty Folders in Outlook PST 2019/2016?

Dealing with empty folders deletion is an easy task if the number of empty folders is less. Microsoft Outlook allows users to delete an empty folder by simply right-clicking on it and selecting the Delete Folder option from the list.

This way of deleting empty folders in Outlook is not viable if there are numerous empty folders. It takes a lot of time for users to complete the manual deletion of these subfolders. So, there is a need to find an alternative solution.

If you have Outlook PST 2019/2016 and are ready to take a chance, follow the given procedure to delete empty folders from Outlook.

Permanently Delete Empty Folders in Outlook PST 2019/2016 Using VBA Macro Code

This VBA Macro Code is to delete all empty sub-folders in any Outlook folder. Let us know the process stepwise.

  1. Launch the Microsoft Outlook application.
  2. On the opened application, press the Alt and F11 keys to launch the Microsoft Visual Basic for Applications or move to the Developer menu and click on the Visual Basic option.Click on Visual Basic
  3. Go to the Insert menu and click on the Module option.Click on module option
  4. A new module window will get opened. Paste the following VBA macro code to delete all the empty subfolders from the Outlook folders.
  5. 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

  6. To run this Macro code, either press the F5 key or click on the Run option.
  7. In the Select Folder dialogue box, select the Outlook folder for deleting its empty sub-folders and click on OK.select the Outlook folder
  8. Check if the subfolders are deleted now from the Outlook folders after restarting the Outlook application once.

The method is a bit technical and needs to be followed carefully for accurate results.

Sometimes, these empty folders and sub-folders are not easily identifiable when you plan to delete them manually. We propose the automated solution to find various Outlook folder properties, including the empty folder information – Kernel Outlook PST Reporter tool. It scans the Outlook profile thoroughly and provides information such as PST folder items number, folder size, types of items, etc. in the generated report. So, those folders which have 0 file items can be easily identified. So, this tool can help you simplify the manual deletion of empty folders.

The software generates multiple reports to provide users some crucial information related to the Outlook data like read/unread messages, email attachment type, size, and number. Go to the website to download this tool for free.

Summary

Trouble due to empty folders in the Outlook application is discussed in this blog. Also, two genuine solutions to permanently delete empty folders have been described with the procedures. Also, a simple solution is introduced as well to identify the empty folders in the Outlook PST file.

Kernel for Outlook PST Repair