• Advertisement
Sign in to follow this  

BASH selective copy question.

This topic is 3943 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am trying to copy one directory tree to another, but I don't want to copy any file which has .svn in it's path. If anybody has a solution, could you also possibly point me towards some good material on this subject? I'd rather know how to do this in future instead of sapping the collective talents of the GD boards every time I have a BASH question! Kind regards, Mark

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by mrmrcoleman
I am trying to copy one directory tree to another, but I don't want to copy any file which has .svn in it's path.
find srcdir \( ! -name . -a ! -path \*.svn\* \) -exec cp {} dstdir \;
where srcdir and dstdir are your source directory and destination directory, respectively. Alternatively,
find srcdir ! -name . | grep -v \.svn | xargs -i== cp == dstdir
is likely to be faster for larger directories.
Quote:
If anybody has a solution, could you also possibly point me towards some good material on this subject?
man find will give you the manual for the find command. Between find, grep, sed, and the occasional xargs you can do pretty much any file manipulation you can dream up. They all have man pages.

Share this post


Link to post
Share on other sites
why not just use the svn export command to get a copy of that directory without the .svn folders?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement