I want to create a file with the output of a grep search but in a folder included in the search. If I do:

```
grep -rnw . -e "text" > test/files.txt

```

It never ends because it always add one more files.txt. How can I do it after it finishes?

```
grep -rnw . -e "text" >| test/files.txt

```

This gives the same output than the previous one.
Any idea?