I would like to merge all the files under a folder and its subfolders into a file total.txt, so I try
find . -type f -exec cat {} +; > total.txt
and the output can't be redirected
pipe can't work either:
find . -type f -exec cat {} + | cat > total.txt
It maybe caused by -exec which takes all the arguments after it as the command?
Is it right? And how to fix it? Or is there a better way to achieve this.
Any help will be appreciated :)
..and I suggested using! -path ./total.txt.