The issue arises because your grep is always true - you need to swap the string "\\*?.txt" to the regular expression /\\*?.txt/ so you filter out the directories . and .., as well as non-.txt files.
There are some stylistic modifications I could suggest, but this would fix the immediate issue.