foxfirefey: A guy looking ridiculous by doing a fashionable posing with a mouse, slinging the cord over his shoulders. (geek)
[personal profile] foxfirefey posting in [community profile] command_liners
There is something imminently satisfying about using find and xargs to accomplish tasks on files in the folder tree:

find . -name "*.orig" | xargs rm

I use it to delete certain leftover files from editors or version control systems, or to change the permissions on all of a certain kind of file. I also use it to recursively grep in certain instances:

find . -name "*.pl" | xargs grep -i "OpenID"

Here are a couple of articles for those interested in learning more about this awesome combo:

Advanced techniques for using the find command
Unix Xargs Piping Toolkit Utility

Date: 2009-10-07 03:18 am (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I love the find/xargs combo *__*

One trick for deleting found (find-ed?) files, I usually use:

find . -name "*.orig" -delete

just so I'm sure I don't accidentally add arguments to rm.

Profile

command_liners: A command line prompt with a blinking cursor after it, green against black. (Default)
Command Liners

January 2022

S M T W T F S
      1
2 345678
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 7th, 2025 11:22 am
Powered by Dreamwidth Studios