Easier Way To Empty Folder And Subfolder Contents Retaining Folder Structure In Windows XP

In my previous post, I wrote how you can create a registry hack to add a new context menu, which will clear all the content within folder and subfolders, but will leave the folder structure intact. I figured that a lot of users may not be comfortable playing around with registry, and you should not attempt to play around with it if you do not know what you are doing. (Related post: If you are comfortable handling registry entries read this post, else continue reading further.)

So here’s another easy way to create a new ‘Context Menu Item’ which will empty the folder and sub-folder content and the best part is you don’t do any registry hack or any such thing.

1> First you need to create a batch file and name it as clearFolderSubFolderContent.bat . (Related post: if you don’t know how to – read this post ),

2> This batch file can be anywhere on your system, but to maintain system uniformity keep it in C:\WINDOWS\system32, assuming you have installed the Windows Operating System in ‘C’ Drive, if you have installed it in another folder, then drill down to the System32 folder . So technically speaking, the batch file will be physically available in “C:\WINDOWS\system32\clearFolderSubFolderContent.bat” in my case.

3> Right click on the batch file and click ‘edit’, the batch file will open in a text editor. Type “cmd /c “cd /d %1 && del /s /f /q *.*” in it, save the file and exit. Note: Do not include the quotes.

4> Open any folder, go to ‘Tools –> Folder Options –> File Types –> select Folder –> click Advanced –> click New

Easier Way To Empty Folder And Subfolder Contents Retaining Folder Structure In Windows XP

5> A New Action, window will pop up. In the Action field fill in ‘Empty Folder And SubFolder’ and and in the Application used to perform action fill the physical address of the batch file you have created above, in our case it is “C:\WINDOWS\system32\clearFolderSubFolderContent.bat”. Click OK till you exit out of all windows and the value will be saved.

Now when you right click on any folder you’ll see a new item in the context menu – Empty Folder And SubFolder’, which will purge all the files from the folders when clicked.