Button To Selectively Delete Files From A Specific Folder

I am looking for a button that will delete all the files in the "C:\Users\shawn\AppData\Local\Temp" directory, except the folder "Howard.exe" and any files in that folder. I have one that will do that in the current folder when pushed, but am looking for one that will delete those files no matter what folder I am in.

Thanks for any help that you can give me.

Shawn

You can use the {alias|temp} to automatically resolve the "C:\Users\shawn\AppData\Local\Temp" path. So create a copy of your current button and replace the code for current folder (probably {sourcepath} or similar) with that one.

If in doubt, post the code of the current button.

This is the code that I am using which does it job, I was just wondering if I could have a button that did the same thing, but without me having to go to the folder to use it. If it can't be done, it is no big deal, it was just a way to save me a few keystrokes.

Select ALLDIRS
Select (*.*)
Select DESELECT (Howard.exe)
DELETE

Happy deleting :slight_smile:

Go "C:\Users\shawn\AppData\Local\Temp\Howard.exe" OPENCONTAINER
Select INVERT
Delete

You don't have to navigate to the folder at all, unless you want to visually see what's about to be deleted first.

Delete "C:\Users\shawn\AppData\Local\Temp\~(Howard.exe)"

(Note that this will delete folders as well as files, as will all the other buttons in this thread so far.)


As an aside, in your button you were using Select (*.*) -- Be aware that that will only select things with a dot in their names. Filenames don't have to contain any dots. Use * instead of *.* if you want everything.

1 Like

Thanks once again Leo, that worked great.

This leads me to another question. Is there a way to automatically skip those files that are locked? That would save the another 4 clicks. :grinning:

The Delete QUIET argument should do that, at least according to the docs.

(If the recycle bin is being used it may also depend on Windows to some degree.)

No, it didn't work, but not that big a deal.

Thanks to all the people that answered my request.

Shawn