Linux – recursively copy all files from one directory to another with exceptions

linux

How do i need copy all files except a couple of directories from one directory to another.
for eg:

cp -R test /www/test2 would copy all

But i want to exclude 2 folders called log and logs.

I tried something like:

find ~test -not -name logs,log |  cp -R test /www/test2 

But can you help me with the syntax?

Best Answer

Use rsync:

rsync -a --exclude=logs --exclude=log from/ to/
Related Question