Delete files with specified suffix in specified folder under Linux

This method can be used to delete a file with a suffix in a folder. Of course, the format of the file name can be defined by yourself, not necessarily by specifying a suffix, but by specifying a prefix, etc.
From: drizzle and glimmer

Method 1

Find Directory – name “*. ABC” | xargs RM
command is a bit dangerous, you can first execute the first half to see if it is the file you want to delete, and then execute the whole

method 2:
find. – name ‘*. Exe’ – type F – print – exec RM – RF {} \;
(1) “.” means to search recursively from the current directory
(2) “- name ‘*. Exe'” to search by name, all the folders or files ending with. Exe should be found
(3) “- type F” the type of search is file
(4) “- print” the directory name of the output search file
(5) The most important thing is – exec. The – exec option is followed by a command to be executed, which means that the command will be executed for the found file or directory.
The exec option is followed by the command or script to be executed, followed by a pair of {}, a space and a \, and finally a semicolon


Read More: