I have to copy contents of some code from one folder called aim-db-dir to another called aim-db-dir_nosvn. aim-db-dir contains .svn folders in all the directories (and subdirectories) and these .svn folders contain some folders and files which I am not concerned with. I want to copy everything in the directories and subdirectories under aim-db-dir except the .svn folders and its contents.
So my question is how do I do this. I read about rsync but am not sure we can exclude directory and file patterns. Also I tried to do using find and cp but I am missing on something.
The command I am trying is something like (doesn't work)-
find aim-db-dir/* -not -name ".svn" | sed -n 's|^aim-db-dir/||p' -exec cp -R "{}" "aim-db-dir_nosvn/{}" \;
I also thought of using xargs but I never used so not sure if it can be made use of. Multiple solutions are appreciated!
gnu tarprogram has a--exclude-vcsoption, which will avoid all.svndirectories. You can pipetarto/from stdout/stdin, and use-Cto get to the correct starting directory.