Trying to find any files of certain pattern in a directory and its subdirectories. I tried:
C:\test\workspace>dir *.*.r[0-9]* /s /b
File Not Foundin hopes to find files like
abc.txt.r12222
tjy.java.r9994Where an number is appended after the letter r, done by SVN.
What am I doing wrong?
14 Answers
I just answered this on Stack Overflow a couple of days ago.
In your case it would look like:
dir * /s/b | findstr \.r[0-9]+$Update
The * in the one of the other examples ".r[0-9]*$" also finds records that end in 'r' since the * quantifier means 0 or more.
4My suggestion for you is to do that with grep - an utility for UNIX-like systems that has been ported to Windows and can match lines using regular expressions.
grep is included with MinGW's MSYS package, the installer can be found here. (install only MSYS)
Then you'll have to add MSYS tools to your PATH variable, dafeult directory for MSYS is C:\MinGW\msys\1.0\bin
Finally you can do your serach with this command:
ls -a | grep ^.+\..+\.r[0-9]+$... which means: "get output from ls -a (file listing including hidden files) and pass it to grep, match lines that look like ..r[0-9]* (with at least one character symbolized by each asterisk)".
Please try by navigating to c:\windows\system32 where the findstr is located and then execute the suggested commands.
You can try this:
dir /a| findstr .r[0-9]*$For help, type findstr /?.