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
  • 45,646
  • 26
  • 189
  • 275

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
  • 252,262
  • 96
  • 511
  • 570
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,265
  • 2
  • 25
  • 43