Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Linux, how do I recursively copy files while ignoring certain names?

I need to recursively copy a directory tree, ignoring any subdirectories named 'CVS'. Is there a simple way to do this?

like image 745
codebox Avatar asked Aug 17 '09 12:08

codebox


2 Answers

rsync -av --exclude=CVS <src> <dst>
like image 157
ubiyubix Avatar answered Nov 13 '22 01:11

ubiyubix


tar -cpf - --exclude=CVS directory | sh -c 'cd /wherever/it/goes && tar -xpf -'

Modify the right-hand tar's options to -xvpf if you'd like to see what's going on.

like image 32
chaos Avatar answered Nov 13 '22 01:11

chaos