Read time: 5 minutes
An Outlook database file (PST) holds the structural hierarchy of the mailbox and its folders. Some default folders are internally created, but users can create other folders as per requirement. So, the database file grows exponentially as many emails are sent and received, which occupy the database file storage space in Outlook and require data management.
Users have 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., 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 remove empty folders in Outlook PST 2019/2016?
Dealing with empty folder 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 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.
- Launch the Microsoft Outlook application.
- 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.
- Go to the Insert menu and click on the Module option.
- A new module window will be opened. Paste the following VBA Macro code to delete all the empty subfolders from the Outlook folders.
- To run this Macro code, either press the F5 key or click on the Run option.
- In the Select Folder dialogue box, select the Outlook folder to delete its empty sub-folders and click on OK.
- Check if the subfolders are deleted now from the Outlook folders after restarting the Outlook application once.
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
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
The method is a bit technical and needs to be followed carefully for accurate results.
Use automated software to delete the empty folders in Outlook
Sometimes, empty folders and sub-folders are not easily identifiable when you plan to delete them manually. So, we propose an 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 that 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 with some crucial information related to Outlook data like read/unread messages, email attachment type, size, and number. Download this tool for free today!
Conclusion
The process of deleting empty folders permanently frees up the unused space in the Outlook data file. The above-mentioned manual practices require technical expertise that may trouble you a lot. So, use the recommended Kernel Outlook PST Reporter software to identify and filter the folders from your Outlook account with ease. You can also perform deletion or other actions in the report generated by this software.