<p>I can do this:</p>

<pre><code>$ find .
.
./b
./b/foo
./c
./c/foo
</code></pre>

<p>And this:</p>

<pre><code>$ find . -type f -exec cat {} \;
This is in b.
This is in c.
</code></pre>

<p>But not this:</p>

<pre><code>$ find . -type f -exec cat &gt; out.txt {} \;
</code></pre>

<p>Why not?</p>

find's -exec argument runs the command you specify once for each file it finds. Try:
```
```
$ find . -type f -exec cat {} \; > out.txt
```
```
or:
```
```
$ find . -type f | xargs cat > out.txt
```
```
xargs converts its standard input into command-line arguments for the command you specify. If you're worried about embedded spaces in filenames, try:
```
```
$ find . -type f -print0 | xargs -0 cat > out.txt
```
```