Copy all files and folders excluding subversion files and folders on OS X
Posted
by
Michael Prescott
on Super User
See other posts from Super User
or by Michael Prescott
Published on 2009-09-28T14:23:16Z
Indexed on
2011/01/04
0:55 UTC
Read the original article
Hit count: 917
I'm trying to copy all files and folders from one directory to another, but exclude certain files. Specifically, I want to exclude subversion files and folders. However, I'd like a general yet concise solution.
I imagine I'll find the need to exclude several types of files in the near future. For example, I might want to exclude .svn, *.bak, and *.prj.
Here is what I've put together so for, but it is not working for me. The first part, find works, but I'm doing something wrong with xargs and cp. I tried cp with and without the -R
. Also, I'm using OS X and it appears to have a less featured version of xargs than linux systems.
find ./sourcedirectory -not \( -name .svn -a -prune \)
| xargs -IFILES cp -R FILES ./destinationdirectory
© Super User or respective owner