Let's say I have a directory with multiple files, all of which are either binary files (files with no declared extensions) and source files (.c extension). I do this:
$ ls
and get:
README.md hello-world.c hello-world get-name.c get-name
and I want to list only files with a specific extensions (say both .c and .md), I do:
ls *.c *.md
and that's ok!
But what if now I want to delete all files that do not have a .c or .md extension, how can I do this?
I know how to do it to files whose extensions are known to me, like:
ls *.c *.md | xargs rm
But how do I tell the command line to delete the files that DON'T match my criteria?


