andor kesselman
andor kesselman

Reputation: 1169

find command cygwin problems

I"m having a problem with the "find" command on cgywin. I have a test file here found with this command:

$ find . 'test'
.
./asdftest
./asdftext.txt
./test
./test/asdfastest.txt
./test/test.txt
./test.txt
./textasfa.txt
test
test/asdfastest.txt
test/test.txt

I am completely baffled as to why when I do

find . -regex 'test'

I get nothing as the result. I have tried many many combinations and never any luck. Whats going on? Thanks in advance.

Upvotes: 1

Views: 638

Answers (1)

anubhava
anubhava

Reputation: 785256

You need to use -name option:

 find . -name '*test*'

With the -regexoption, following will work since each filename will start with ./:

find . -regex './.*test.*'

OR more accurate:

find . -regex '^\./.*test.*'

Upvotes: 1

Related Questions