Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 Found

in hopes to find files like

abc.txt.r12222
tjy.java.r9994

Where an number is appended after the letter r, done by SVN.

What am I doing wrong?

share|improve this question
2  
Welcome to SU! On stackexchange sites, when an answer has helped you, the way to thanking people is to upvote their answer and to accept it (by clicking on the checkmark to the left of an answer) if it solved your problem. I'm only saying because you seem to have accepted none of the answers you have received for your questions. –  terdon Mar 24 '13 at 14:33
add comment

3 Answers

up vote 2 down vote accepted

I just answered this on Stack Overflow a couple of days ago. http://stackoverflow.com/questions/15648679/find-text-string-or-part-of-text-with-dot-in-grepwin/15648872#15648872

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.

share|improve this answer
    
Hi cpattersonv1 - thanks for responding dir * /s /b | findstr \.r[0-9]*$ works –  chz Mar 29 '13 at 20:27
add comment

My 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)".

share|improve this answer
    
hi gronostaj thanks for the response; I tried $ ls -R | grep -H ^.*[0-9]$ (standard input):res.jar.r469621 (standard input):res.jar.r464460 (standard input):test.jar.r46521 (standard input):test.jar.r46970 –  chz Mar 24 '13 at 20:23
    
Hi I still cant get the full path name of the filename; how do I do that ? eg c:\pager\test.jar.r46521 as opposed to (standard input):test.jar.r46521 –  chz Mar 24 '13 at 20:25
    
ls | grep is the same as dir | findstr in Windows. –  AbsoluteƵERØ Mar 28 '13 at 21:32
add comment

You can try this:

dir /a| findstr .r[0-9]*$

For help, type findstr /?.

valid XHTML.

share|improve this answer
    
Hi mfm4aa thanks for responding - cant seem to work; I've tried all combinations and none gives ant listed answer: Eg inline C:\Temp>findstr /S /B [0-9] . C:\Temp>findstr /S /B r[0-9]$ . C:\Temp>findstr /S /B $.*r[0-9]$ C:\Temp>findstr /S /B $.*r*$ C:\Temp>findstr /S /B $.*r..*$ C:\Temp>findstr /S /B $.*r\..*$ C:\Temp>findstr /S /B /R $.*r\..*$ C:\Temp>findstr /S /B /R "$.*\..r[0-9]*$ C:\Temp>findstr /S /B /R "$.*\..r[0-9]*$" C:\Temp>findstr /S /B /R "$.*\..r[0-9]*$" . C:\Temp>findstr /S /B /R "$.*\..r[0-9]$" . C:\Temp>findstr /S /B /R "$.*[0-9]*" . C:\Temp>findstr /S /B /R "$*[0-9]*" . –  chz Mar 24 '13 at 19:27
    
Please try: C:\Temp>dir /aa| findstr .r[0-9]*$ –  Endoro Mar 24 '13 at 19:32
    
Hi mfm thanks for writing - i still cant find C:\Temp>dir /aa | findstr .r[0-9]*$ File Not Found –  chz Mar 24 '13 at 20:29
    
:) simply type dir /aa| findstr .r[0-9]*$. That does working here... –  Endoro Mar 24 '13 at 20:36
    
Hi Endoro thanks for responding. It didn't work - it says File Not Found –  chz Mar 29 '13 at 20:23
show 1 more comment

Your Answer

 
discard

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.