Kevin Warrington

Loading clever subtitle...

Using Results From the Find Command

The following will find all .patch files and copy them to some directory:

1
find . -name '*.patch' -print0 | xargs -0 -I % cp % some/directory

Explanation

Each result is printed to stdout, followed by an ASCII NUL character -print0. These are passed to xargs which is configured to expect the NUL character -0 as the separator. -I % is used to identify a substitution character, which will be replaced in the following command cp % some/directory.

Comments