Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

I have a Windows Explorer folder that contains files that are named file0001, file0002 etc. I would like to select and open only the files with an even number in the name.

My approach is the following. I enlarged the icons and made the Windows Explorer window smaller, such that the files are shown in 2 columns:

file0001 file0002

file0003 file0004


Is there a way to select the second column here? Or is there another (fast) way to do this.

share|improve this question
I assume the files are sorted by name? – Dave Jan 15 at 13:13
After selecting the second column, what are you planning to do with the files? – doenoe Jan 15 at 13:17
How long is this list? IF the list fits on your screen without scrolling, then a dreadful work around is to use AutoHotKey, where you move the mouse N pixels down and click, since the height of each item in the list is the same (in details view) – Dave Jan 15 at 13:18
- @David: Yes. - Frank Thomas: Indeed. - doenoe: Open them in Windows Photo Viewer. - Dave: Nice trick, but the list can be quite long. – Karlo Jan 15 at 13:27
Use powershell Get-ChildItem | Where-Object {$_.Name -match "[0,2,4,6,8]$"} will list all files ending with an even number, then you can pipe this list to some other command (eg. I would use move to move them to another directory) – Zina Jan 15 at 13:58
up vote 13 down vote accepted

Yes, this is possible if your files are named as you describe (as long as you don't miss any files out so the 'second column' is always even). What you can do is select every other file, choosing where you start (and thus selecting odd or even)

If you View by icon (I chose large icon) and change the width of Windows Explorer so it only has "2 columns" , then you can hold down CTRL and use left click and drag with the mouse, downwards (from just above the first icon in the "second column" (in the white space)).

As an aside, depending on how many columns you have, you could also select every third file or fourth file etc

I've just done it, and it will automatically scroll as well.

You can even then maximise Windows Explorer (File Explorer) and the selection will kept.

share|improve this answer
Indeed. My mistake was that I started by clicking on the first file. You have to start by clicking on the white background next to it instead. – Karlo Jan 15 at 13:30
It's worth noting this will only work if the files are consecutive, if a number is missing the order well mess up (+1 for simplicity though, and I realise the question wanted this as the answer) – Jonno Jan 15 at 13:40

to separate off such files, rather than just selecting them as described by other posters:

install cygwin from

make sure you select perl to be installed during the installation process

open a cygwin shell

copy the entire contents of your target directory to somewhere safe

cd to your directory using cd /cygdrive/c/path/to/your/dir

This command will delete all filenames which are not even from your target dir, so I repeat, ensure you have backed up first. It looks for consecutive runs of numbers, eg file864.ext to calculate if it's odd or even. if your files are numbered any other way eg file3xyb345, then this won't work.


perl -e 'while (<*>) { ($num) = $_ =~/(\d+)/; `rm "$_"` if $num % 2 }'

You are now left with only even numbered files in that dir. the rest are gone.


share|improve this answer
Seems like a lot of work for this, particularly considering you could ... just install perl in windows, or use powershell, or even CMD/batch, if programmatic solution were desired. – Joe Jan 15 at 19:23
Yes, I slightly mis-read the q on this one :) – Pingers Jan 15 at 23:08
@Pingers This was not really what I was looking for, but thanks for sharing this method. – Karlo Jan 18 at 7:46
Not the easiest way to go for this simple criterion, but if you do have cygwin installed, then there are all sorts of things you can do (relatively easily) just in the bash shell it provides to sub-select files in almost any way imaginable - for cases far more complex than this one. – Joe Jan 18 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .