../Msgboard/Modding your system/Missing context menu extension?
starla - 12 Sep. 2004 - 00:51:
Missing context menu extension?
I've been looking for a certain extension allover the web; I'm sure I saw it before. It's the registry entry or program to add a "delete contents of folder" to the context menu, to save all the hassle of opening the folder then deleting all the files from it.
Does anyone know where I can find it, or even how to write it myself?
Thanks very much.
12 Sep. 2004 - 01:52
starla
Having had a bit of free time I decided to try to do it myself. This is how far I've got:
Making new registry key:
HKEY_CLASSES_ROOT\Directory\shell\Empty Folder
Trying to perform the delete command after going to the specified directory.
default: (REG_SZ): command.com /k cd %1 del \*.*
I can't get a "del \*.*" batch file to run here either.
I think that if only I can get the delete command to work it will be OK, any ideas on how I word that series of commands?
12 Sep. 2004 - 20:55
beaker
try this:
del /q %1\*.*
if it doesn't work then try:
command.com /k del /q %1\*.*
What OS are you runnning starla? I'm guessing Win 9x since you're calling command.com and not cmd. You might need to experiment with quotes around %1 as well.
13 Sep. 2004 - 14:19
starla
No, still nothing - either invalid path or invalid directory.
I'm using Win2K SP4, but still with command.com as that's what I'm used to.
Adding quote marks doesn't fix the problem either, and when I try using the && to join commands, like: command.com /k "cd %1 && del \*.* " it isn't recognised at all

21 Sep. 2004 - 03:52
diamondhead
21 Sep. 2004 - 22:16
beaker
starla, how about use a batch file that accepts a parameter of %1? If you need help, let me know.
Also, I could write something (VB or C#) fairly quickly. I could have written something already if we'd just gone down that road, I just thought there would be a solution via batch.
22 Sep. 2004 - 04:07
diamondhead
Yes, please write it asap. I found that ShellToys XP doesn't have that option at all. It would be awesome to have such a thing. Thanks.
22 Sep. 2004 - 06:01
beaker
starla/diamondhead, created a C# command-line app called
EmptyDir.
Here's what I added to my registry:
[HKEY_CLASSES_ROOT\Directory\shell\Empty Directory\command]
@="emptydir %1"
It works with folders with spaces, it does delete hidden files but not files in subfolders. Let me know what you think.
22 Sep. 2004 - 06:57
diamondhead
I downloaded the app and ran it and then added those values to the registry and that option then got added to my right click menu. But, when I tried to use it, this command prompt window appears briefly and, when I go to see if the folder is empty, the contents are still present. I am running Windows XP Prosessinal SP1 if that helps explain anything.
22 Sep. 2004 - 10:15
plastic
Oops, think it was starla who submitted a news item on this. He got it to work, I just wanted to test if and how it would work in different OS's. He used this:
cmd /k "cd %1 && del *.*"
22 Sep. 2004 - 14:55
diamondhead
Fuck yeah! That worked thanks a million, Plastic!!! This is too cool!
22 Sep. 2004 - 15:01
diamondhead
It worked in XP Pro SP1 at least.
22 Sep. 2004 - 16:49
beaker
plastic, glad to hear starla found a more efficient solution.
diamondhead, are you logged on as the administrator account?
22 Sep. 2004 - 20:05
diamondhead
Yes, I am. Why do you ask?
22 Sep. 2004 - 23:26
beaker
Wondering why it didn't work, it worked fine here. Was wondering if it had to do with what account was running the app.
23 Sep. 2004 - 01:03
plastic
Hmm, beaker, worked for me (admin account, xp sp1). Not only worked, scared me a little. Not sure if starla's settings do the same (didn't try), but them files don't get in the bin ? I don't trust myself with this, I'm afraid

.
23 Sep. 2004 - 02:04
beaker
I rarely use the Recycle Bin. I typically do the shift-delete method to bypass it. I've only regretted a delete a few times
Interesting to hear it worked for you. I'm writing something for my stepdad now and am getting an unauthorized access message when attempting to write to the registry (also running the admin acount). I wonder if calling a process to regedit would have the same error...sometimes security kills you.
23 Sep. 2004 - 02:45
diamondhead
It's pretty wierd that beaker's prog. worked for you in your system but not mine, Plastic. I was probably doing something wrong with beaker's prog. It doesn't matter to me at this point anyways. I got a solution that works for me. I am happy. :-)
23 Sep. 2004 - 14:24
diamondhead
Hey, I got this from this other forum. Replace cmd /k "cd %1 && del *.*" with this: cmd /c "cd %1 && del *.* /f /q && (for /d %%a in (*) do rd "%%a" /s /q)"
This supposedly will delete everything inside the folder, including subfolders and readonly files, without questions and bypass the recycle bin. Pretty wicked, eh? I'm gonna try it out right now.
23 Sep. 2004 - 14:34
diamondhead
Use with careful discretion! It does work!
17 Mar. 2005 - 17:09
skywalka
Hey DiamondHead (or anyone else who may know!)
I know it's been a while but U can U tell me what to type so that subfolders & readonly files R deleted without question but DO go 2 the Recycle Bin.
Thanx.
ps Where is the other forum that U found that last command on?
04 Apr. 2005 - 03:24
Serenity
Skywalka, from looking at
this I don't think you can delete without prompt to the recycle bin.
If you are interested, I wrote
this app that deletes to the recycle bin. (You'll need to first edit the install reg file to include the path to the exe; do not omit the "%1" after the path.) If launched from clicking on a file, this will delete *everything* in the folder in which the file resides to the recycle bin. If launched from clicking on a folder, this will delete everything inside that folder to the recycle bin.

06 Apr. 2005 - 09:01
skywalka
Hi Serenity.
That looks very interesting. Unfortunately the download is not working @ the moment.
ps Can anybody tell me if it is possible 2 receive email notifcation of replies to posts on this forum?
06 Apr. 2005 - 09:49
Serenity
Oops, link fixed now.
06 Apr. 2005 - 10:42
skywalka
I installed the reg file without altering it. I thought I'd edit the paths in the registry.
When I tried 2 use it I got the Open With box that Windows displays for unassociated files. I knew the path I'd entered was correct because I copied the path to the clipboard using the context menu.
I tried placing the exe in a test folder & running it thinking it would work in the folder it was placed. I received a message "Windows cannot be deleted as it is required for the system to run" or something like that. Luckily I checked my C drive & found that all files in the root were deleted. This includes files required to boot the computer (boot.ini etc) & the System Volume Information folder!
Phew!!! That was 2 close. I think U better warn people not 2 run the exe as a standalone.
I tried copying the exe 2 the root of c drive & entering that path into the registry & the context menu option now worked fine. Here is the path I cannot get 2 work. Do U know Y this path will not work? I kept it in inverted commas & kept the "%1" @ the end also.
C:\Installationz\Context Menu\specific commands\deletion\Empty Folder\EmptyFolder.exe
06 Apr. 2005 - 11:17
Serenity
That's very strange. Did you click on a folder or a file to execute when this happened? I know that if you omit the %1(required to pass the path of the item you clicked on to the program) it will run the exe without a path and should not delete anything. If you run the program via doubleclick it should also do nothing. Did you specify double slashes in the registry file? When I edit the path in the registry I need to put it in exactly like this:
"x:/path to exe/EmptyFolder.exe" "%1"
What OS are you running Skywalka?
06 Apr. 2005 - 18:32
skywalka
I tried running it from a folder & a file. Both activated the open with box.
Not sure what U mean by double slashes so I have copied the actual registry key:
"C:\Installationz\Context Menu\specific commands\deletion\Empty Folder\EmptyFolder.exe " "%1"
I notice your example has forward slashes instead of backslashes. I doubt that has anything 2 do with it.
I'm running Windows XP.
06 Apr. 2005 - 22:27
Serenity
Skywalka, I've updated the exe to simply exit if no path is passed to it as a failsafe for anyone who attempts to run it as a standalone program. Regarding the %1 issue, would you add
this test app in place of EmptyFolder, and try moving it in different locations/drives? When launched from the shell menu, this app simply displays a message box with the contents of %1, which should be the full path to the file/folder you clicked.
08 Apr. 2005 - 06:45
skywalka
Hey Serenity, I've located the problem & it is not on your side.
I used Send to Toys
http://gabrieleponti.com/ to copy the filepaths. If U examine the path I pasted above U will C that an extra space has been added to the end. This happens with any path copied using this program.
Sorry 2 wate your time.
I've informed the author:
http://forums.gabrieleponti.com/viewtopic.php?t=28
Have U thought about adding the command 2 the context menu of a blank space inside a folder also?
Looking forward to U posting the updated version.
16 Apr. 2005 - 20:27
skywalka
Hey Serenity.
Have U forgotten 2 post your updated version or R U still working on it?
I was looking forward 2 using this.
16 Apr. 2005 - 23:33
Serenity
Hi Skywalka, you can get the new version of it
here.

I've tested it on my computer, though due to the nature of this app I advise using it with caution. If in doubt, do empty your Recycle Bin first and test it with some folders/files. Behaviour is the same as before - if launched from clicking on a file, this will delete the contents of the folder in which that file resides, and if launched from clicking on a folder, this will delete the contents inside that folder.
17 Apr. 2005 - 20:15
skywalka
Cool, thanx.
I'll give it a go.
Y don't U add the option to right click the inside of a folder also.
Please log-in to post.
You need to be logged in to post. To log-in, or to register an account go -
there.
Options
../Msgboard/Modding your system/Missing context menu extension?