On 07/11/2012 05:27 PM, Peng Yu wrote: > Hi, > > I need to cp a directories with all the the subdirectories matching a > pattern removed (ignore all the test* subdirectories). There can be > many solutions to this problem. I'm wondering if anybody is aware of > an easy and robust solution. Thanks!
This sort of thing is surprisingly tricky. I've used something like the following in the past: (cd dir1 && find -mindepth 1 \( -type d -a -name 'test*' \) -prune -o -print0 | tar --null -T- -c) | (cd dir2 && tar -x) The above can be easily extended by putting ssh in the pipe. cheers, Pádraig.
