Delete All Files in Main Folder and Sub Folder While Maintaining Folder Tree Structure in Windows XP
Most of the times we have to delete all the files in main folder and sub folders but by maintaining the tree structure of folders. However, this function is not provided by Windows OS by default.
You’ll be able to conduct this activity manually by selecting the folders and pressing the Delete button. Furthermore, you must carry out the above process selecting the files in sub folders.
When the folder tree structure is complex, then this method may be pretty time consuming. To do along with maintaining the folder tree structure, you can use a simple method. By editing the registry, you can modify the right click folder menu to use this utility.
Following is a step by step instruction set to edit the registry:
- Just go to Start and then “Run”. Type ‘regedit’ to open registry editor
- Navigate to the following sub key- HKEY_CLASSES_ROOT\Directory\shell
- Now, right click on ‘shell’ folder, select New then go to Key. Create a new sub key and name it as ‘Empty Folder Contents’.
- Now, right click on ‘Empty Folder Contents’. Select New. Go to Key and give name to sub key as ‘Command’.
- Under this sub key, make a double click on ‘Default’ option. It is located in the right window.
- You will be prompted with a small Edit String pop-up window. Just enter the following value: cmd /c “cd /d %1 && del /s /f /q *.*
- Finally, to save all the setting, hit OK button.
Now, whenever you want to delete all the files in folders and sub folders with maintaining the folder tree structure, just right click on that folder and select ‘Empty Folder Contents’ option.