Question: I always have to submit the source codes in my printed assignment report. **I have to copy and paste my course codes** into the document and I find that it is an annoying task.

I want to solve this **"copy and paste"** problem. Therefore I did it with `cat` like that but it only works in the current directory. I hope it can display the file contents recursively.

```
ls -R *.java | xargs cat >> all_course.txt

```

Answer: 
```
shopt -s globstar
cat **/*.java >> all_course.txt

```

That all\_course file will be a bit of a mess. You probably want to add in some headers or footers:

```
for f in **/*.java; do
    echo "/* *********************************"
    echo " * $f"
    echo " * *********************************/"
    echo ""
    cat "$f"
    echo ""
    echo "/* *********************************"
    echo " * $f"
    echo " * *********************************/"
    echo ""
    echo ""
done > all_course.txt

```
```
find . -name "*.java" -exec cat {} \;

```