Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Windows 7 is there a way to select a file and delete all but that file in a folder? Or is there an app for that behavior already in existence? Maybe a right click menu?

share|improve this question
up vote 5 down vote accepted

Select the file you want to keep and then select Edit > Invert Selection. Then either hit Del or Shift+Del to delete them, or right click over the selected items.

share|improve this answer
Didn't know that existed :-) combined with shortcuts its just: ALT,E,I,DEL – maxfridbe Jan 19 '10 at 21:56
+1 for the almost keyboard only method. Rock on!!! – pcapademic Jan 19 '10 at 23:24
@EricJLN While a little clumsy, you can do keyboard-only by pressing CTRL+A to select all, then using the keys to navigate to the file you want to keep, and pressing CTRL+SPACE. – Zurahn Jan 20 '10 at 0:13

Press CTRL+A to choose all items, then hold CTRL and left-click to deselect individual files.

share|improve this answer
And it works with other windows versions. – Artur Carvalho Jan 19 '10 at 21:48
I knew that, I was hoping for a 1 click solution, or 1 keyboard shortcut, every second on the computer helps. This is actually how I do it now. – maxfridbe Jan 19 '10 at 21:50
This is the best answer. Would you really want a "delete all but this" entry in the context menu? How often are you really performing this action? – RJFalconer Jan 19 '10 at 21:56

For a mouse-free solution, with file selected (arrow keys?), Ctrl-A, Ctrl+Space.

You could script this with Autohotkey:

#SingleInstance Force

send ^a
send ^{Space}
send {Delete}

Select file, Alt+D.

To select a file in a folder, you can type the filename whilst the folder has focus. Windows will select the file that matches what you have typed up to that point. Then Ctrl+A, Ctrl+Space, Delete. (Or use above script)

share|improve this answer
I like it. Granted, it will only work where one has made the script. – pcapademic Jan 19 '10 at 23:25
Ty. "Ctrl+A, Ctrl+Space, Delete" is generic. Script just combines that to one key combination – RJFalconer Jan 20 '10 at 0:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.