Delete Files by Using “Empty Folder Contents” In Windows Vista

Delete Files by Using “Empty Folder Contents” In Windows Vista

By preserving and maintaining folders tree structure, the user can quickly remove and empty the entire files contents within a countless order of folders. In some cases, the user might have just needs of deleting all the files excluding the folders that are storing the files.

There is a trick to include contextual menu item named as “Empty Folder Contents” into the right click context menu in Windows XP operating system. This trick also works on Vista, Windows Server 2003 as well as 2008.

Just follow the following steps to run the “Empty Folder Contents”:

  • Open Registry Editor (regedit).
  • Go to the next registry key given below:


  • Just right click on this shell folder after that select New then Key. Make the new sub key named as “Empty Folder Contents, or name it as you like.
  • After that right click on the option Empty Folder Contents after that pick New then Key. Give the name to the sub-key as “Command.
  • Below the sub-key naming Command, click twice on the Default value data which is situated at right window.
  • There is dialog window “Edit String” on the pop-up menu, put in the next value: cmd /c "cd /d %1 && del /s /f /q *.*"
  • Click option “OK”. Save the setting then close the Registry Editor.

You can also download folder and install it if you don’t want to edit and mess up with the system registry manually. After downloading, it allows to fuse the empty-folder-contents.reg values into your main registry.

Now, whenever there is a need to delete all its folder contents, you can just select Empty Folder Contents to delete by right clicking on the folder.

How To Empty Folder And Subfolder Contents Retaining Folder Structure

At times, you may be in a situation where in you want to delete or empty content, within folder and subfolders within it and at the same time, you want to retain the Folder / Directory structure. If the folder structure is small, you can do this task manually, but it can be a real pain if you have a deep folder/directory structure.

This simple registry hack will make it very easy for you to empty the content of the folders and sub-folders. A new context menu item will be added to the context menu, when selected will delete all the content.

Note: If you are not comfortable editing registry values, read this post. It adds the same feature without you dabbling with the registry editors.

Note: You should be very careful when deciding which folder to empty, as the files deleted using this method cannot be recovered as they will be permanently deleted.

1> Go to ‘Start –> Run –> regedit
2> Navigate to ‘HKEY_ CLASSES_ROOT\Directory\shell‘ key.
3> Right click on the key ‘Shell‘ and create a sub-key and name it as ‘Empty Folder And SubFolder Contents
4> Create a sub-key for ‘Empty Folder And SubFolder Contents‘ and name it as ‘command
5> When you select ‘command’ sub-key, you’ll see Default value data in the right pane.
6> Double click on it and enter

cmd /c “cd /d %1 && del /s /f /q *.*”

7> Save the new settings by clicking the OK button and exit registry editor.

Now your contenxt menu will have a new option ‘Empty Folder And SubFolder Contents‘, which will clean up all content for you, but will leave the directory structre in tact !