General Add "Find and Delete Empty Folders" context menu in Windows 11 and Windows 10


  • Staff
Folder_delete2_banner.png

This tutorial will show you how to add a Find and Delete Empty Folders with approval context menu for all users in Windows 10 and Windows 11.

You can right click on folder, folder background, drive, or drive background and click/tap on Find and Delete Empty Folders to Y/N approve deleting any empty folders found within the selected folder or drive.

When you use the Find and Delete Empty Folders context menu, you will need to type Y (delete) or N (don't delete) and press Enter for each empty folder found for what you want. When you have finished answering Y/N for all empty folders found, the terminal window will automatically close. You can also just close the terminal window at anytime to cancel answering Y/N for all remaining empty folders found.

While you must be signed in as an administrator to add or remove the context menu, all users can use the context menu.



EXAMPLE: "Find and Delete Empty Folders" context menu and Y/N approve in terminal window

In Windows 11, you will need to click/tap on Show more options first by default, then click/tap on Find and Delete Empty Folders.



Show_more_options.png
Find_and_Delete_Empty_Folders_context_menu.png
Find_and_Delete_Empty_Folders_Y-N_approval.png



Here's How:

1 Do step 2 (add) or step 3 (remove) below for what you would like to do.

2 Add "Find and Delete Empty Folders" Context Menu

A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Add_Find-and-Delete-Empty-Folders_to_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\FindAndDeleteEmptyFolders]
@="Find and Delete Empty Folders"
"Icon"="shell32.dll,-16715"

[HKEY_CLASSES_ROOT\Directory\shell\FindAndDeleteEmptyFolders\command]
@="powershell -NoProfile -Command \"& {Get-ChildItem -Path '%1' -Recurse -Directory | Where-Object {!(Get-ChildItem -Path $_.FullName)} | ForEach-Object {Write-Host 'Empty folder found:' $_.FullName; $response = Read-Host 'Do you want to delete this folder (Y/N)?'; If ($response -eq 'Y') {Remove-Item -Path $_.FullName -Force}}}\""


[HKEY_CLASSES_ROOT\Directory\Background\shell\FindAndDeleteEmptyFolders]
@="Find and Delete Empty Folders"
"Icon"="imageres.dll,-1025"

[HKEY_CLASSES_ROOT\Directory\Background\shell\FindAndDeleteEmptyFolders\command]
@="powershell -NoProfile -Command \"& {Get-ChildItem -Path '%1' -Recurse -Directory | Where-Object {!(Get-ChildItem -Path $_.FullName)} | ForEach-Object {Write-Host 'Empty folder found:' $_.FullName; $response = Read-Host 'Do you want to delete this folder (Y/N)?'; If ($response -eq 'Y') {Remove-Item -Path $_.FullName -Force}}}\""


[HKEY_CLASSES_ROOT\Drive\shell\FindAndDeleteEmptyFolders]
@="Find and Delete Empty Folders"
"Icon"="imageres.dll,-1025"

[HKEY_CLASSES_ROOT\Drive\shell\FindAndDeleteEmptyFolders\command]
@="powershell -NoProfile -Command \"& {Get-ChildItem -Path '%1' -Recurse -Directory | Where-Object {!(Get-ChildItem -Path $_.FullName)} | ForEach-Object {Write-Host 'Empty folder found:' $_.FullName; $response = Read-Host 'Do you want to delete this folder (Y/N)?'; If ($response -eq 'Y') {Remove-Item -Path $_.FullName -Force}}}\""

3 Remove "Find and Delete Empty Folders" Context Menu

This is the default setting.


A) Click/tap on the Download button below to download the file below, and go to step 4 below.​

Remove_Find-and-Delete-Empty-Folders_from_context_menu.reg


(Contents of REG file for reference)
Code:
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\FindAndDeleteEmptyFolders]

[-HKEY_CLASSES_ROOT\Directory\Background\shell\FindAndDeleteEmptyFolders]

[-HKEY_CLASSES_ROOT\Drive\shell\FindAndDeleteEmptyFolders]

4 Save the .reg file to your desktop.

5 Double click/tap on the downloaded .reg file to merge it.

6 When prompted, click/tap on Run, Yes (UAC), Yes, and OK to approve the merge.

7 You can now delete the downloaded .reg file if you like.


That's it,
Shawn Brink


 

Attachments

  • Remove_Find-and-Delete-Empty-Folders_from_context_menu.reg
    430 bytes · Views: 135
  • Add_Find-and-Delete-Empty-Folders_to_context_menu.reg
    1.8 KB · Views: 245
Last edited:
Back
Top Bottom