0

I have exactly the same problem as this post.

Only instead of finding all the .txt files, I want a list of all files that are not .txt files.

Something like

$ ls -LR | grep -v .java

Which definitely does not do what I want.

Community
  • 1
  • 1
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290

2 Answers2

1

Use find as suggested in that post and negate the -name condition with ! to have the other way round:

find . -type f ! -name "*.txt"
#      ^^^^^^^ ^^^^^^^^^^^^^^^
#   just files        |
#              file names not ending with .txt
fedorqui
  • 275,237
  • 103
  • 548
  • 598
0

Does this work for you?,

ls -lr | grep -E -v "*.txt$"  

I tested it on my end and it worked, -E extended grep

Nachiket Kate
  • 8,473
  • 2
  • 27
  • 45