How do I search for files containing a range of numerics using windows DIR command?

0

I want to be able to isolate and search using the windows DIR command for only the files that contain an extra numeric at the end. How do I do this? I have attached a picture that shows an example of one of my directories the link is below at the end.

"Track 01 1.m4a" and some are named "Track 01.m4a"? How can I list just the ones that were added with the numeric at the end? Also while we are at it? I have multiple duplicates sometimes 4 or five so I'm expecting to have to search for files with a range of numbers like "* [1-4].m4a"

If I can be clearer in my question please ask.

List of files:

enter image description here

Dr. Dan

Posted 2016-07-04T20:17:23.253

Reputation: 103

https://technet.microsoft.com/en-us/library/bb490907.aspx – Richie086 – 2016-07-04T21:56:41.273

Use the findstr command in Windows. Pipe the output of a recursive dir command to findstr and use the proper command line switches to find the files you are looking for using regular expressions. – Richie086 – 2016-07-04T21:58:02.850

Answers

1

dir /b | findstr

will let you do what you want to do.

Michał Masny

Posted 2016-07-04T20:17:23.253

Reputation: 296

Thx ymar, my understanding is dir is sending its output to findstr where I can use better searching commands. Correct? – Dr. Dan – 2016-07-04T22:36:44.353

What if next I want to delete those files I just searched for? – Dr. Dan – 2016-07-04T22:38:25.353

@DanielMiladinovich You can do something like

dir /b | findstr /r /c:"[0-9] [0-9].m4a"

This will display all the files that have the pattern digit-space-digit.m4a in them. Unfortunately, to delete these files, you might have to use a FOR loop. – Michał Masny – 2016-07-04T23:06:40.067