Jump to content
  • Advertisement
Sign in to follow this  
mrmrcoleman

BASH selective copy question.

This topic is 4092 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!