In a Linux terminal, how to delete all files from a folder except one or two?
For example.
I have 100 image files in a directory and one
In bash, you can use:
$ shopt -s extglob # Enable extended pattern matching features $ rm !(*.txt) # Delete all files except .txt files