How to copy "just files" recursively
Use find
:
find folder0 -type f -exec cp {} targetfolder \;
With GNU coreutils
you can do it more efficiently:
find folder0 -type f -exec cp -t targetfolder {} +
The former version runs cp
for each file copied, while the latter runs cp
only once.
With zsh, thanks to **
for recursive globbing and the glob qualifier .
to match only regular files:
cp -p folder0/**/*(.) targetfolder