HOWTO: Recursively delete matching files on the Linux command line

An easy way to recursively delete files matching a particular pattern is to use this one liner:

find | grep "search" | perl -nle unlink

UPDATE – Another handy one liner to recursively delete directories is:

rm -rf `find . -type d -name .svn`

Obviously replacing “.svn” with whatever your directories are called.

This entry was posted in HOWTO, Linux and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">