-5

I have a directory with about 1500 files. Each of these files have a corresponding .txt file of the same name to go along with it. Some of these files are missing the txt files so I need to re-create or re-download them. I need to find a way to list the files that do not have the corresponding .txt. Example of the tree:

    dir/
       file1.ext
       file1.ext.txt
       file2.ext
       file2.ext.txt

I would think bash and ls would be optimal but I am up to using anything.

1 Answers1

2
for f in *.ext; do test -e $f.txt || echo $f; done
gudok
  • 4,029
  • 2
  • 20
  • 30