Windows XP Tips: Delete Contents from Folder without Deleting Folders
ADVERTISEMENTSThere may be many instances where you would want to delete all the contents inside the folder, but wanted to maintain the folder structure as such. By default Windows does not provide any such option. If there are lots of folders inside a particular folder maintaining a folder structure, then its difficult to delete contents from all the folders. This task can be done using a registry entry.
To do this go to Start-> Run and type ‘regedit‘. In the registry, navigate to HKEY_CLASSES_ROOT\Directory\Shell key. Right click on ‘Shell’ and then create the ‘Empty folder Contents‘ sub key with the New|Key. then create the command key in the same way. Open ‘Default‘ by right clicking on it in the right hand side window. and fill it with the following entry- ‘cmd /c “cd /d %1 && del /s /f /q *.*.

Once you close the registry, the new command will appear in the right click menu of the folder. Now whenever you want to delete the contents, select “Empty Folder Contents” and only the contents will be deleted, the folder structure will remain intact.
NB: Please back up your registry before making any changes.
Share & Enjoy




















Feb 8th, 2008 at 4:07 pm
Nice tip. Keep that coming.

Feb 8th, 2008 at 4:20 pm
@Rakshit,
Sure! More tips on the way.
Feb 8th, 2008 at 8:47 pm
Nice tip Nirmal. But you have to put the “warning” notes near the top before someone messed up their registry.
Feb 8th, 2008 at 11:25 pm
Great tip buddy. Will save everybody a lot of time.
Feb 9th, 2008 at 9:07 am
Nice tip Nirmal thanks
Feb 9th, 2008 at 4:38 pm
Very cool tip I have not heard about it before
Feb 9th, 2008 at 7:22 pm
Nirmal, I’ve tried it on XP and its not working, Did anyone get this working.
Feb 10th, 2008 at 10:58 am
@Syahid,
You are right, the warning should be at the top. I forgot that, thanks for that correction.
@Venkat,
I have tried this on Vista and it was working fine, please make sure that you have entered the value with the correct number of spaces.
Feb 10th, 2008 at 12:00 pm
This is one good thing I was looking for after sendto option. Thanks nirmal, I will link you for sure in the next speed linking
Feb 10th, 2008 at 1:15 pm
@Ashish,
Glad that you liked the tip.
Feb 15th, 2008 at 5:35 am
verkat,
The following Key data works on WinXP SP2:
cmd /c cd /d %1 && del /s /f /q *.*
Trackbacks to this post
Feb 10th, 2008 at 4:27 pm