How to Find and Delete All Files with a Certain File Name Pattern in Linux

Suppose that you want to find all files whose file name ends with ‘_s.jpg’ in the current folder in Linux, you can run the following shell command:

find . -type f -name '*_s.jpg'

To delete the files:

find . -type f -name '*_s.jpg' -exec rm -f '{}' \;

Leave a Reply

Be the First to Comment!

Notify of