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:$ lsand get:README.md      hello-world.c    hello-world   get-name.c get-nameand I want to list only files with a specific extensions (say both .c and .md), I do:ls *.c *.mdand 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 rmBut how do I tell the command line to delete the files that DON'T match my criteria?
Get the complement of the result of an ls command
shell;files;ls;wildcards;xargs