Delete all files in a folder that don't match a certain file extension

Created on Mar 22, 2017 by 

  1. copyrm !(*.foo|*.bar|*.baz)


description

Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.

rm


name

rm - remove files or directories

synopsis

rm [OPTION]... [FILE]...

description

This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories.