cp -r without hidden files

Rahul picture Rahul · Jul 19, 2012 · Viewed 47k times · Source

I have two directories and one is empty.

The first directory has many sub directories with hidden files. When I cp -r content from first directory to the second one, the hidden files gets copied too. Any solutions to escape them?

Answer

Eugene Yarmash picture Eugene Yarmash · Jul 19, 2012

You can use rsync:

rsync -av --exclude=".*" src dest