How to pipe “find” to “rm” in bash

rm, like many other programs, takes its arguments from the command line but ignores standard input. You can pipe anything to it you like; it’ll just throw that data away.

So use xarg..this command clean Evolution data:

find ~/ -iname "*evolution*" | xargs rm -R

If filenames contain newlines or spaces:

find . -name ".txt" -print0 | xargs -0 rm
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s