1

In a Jenkins job, I have a build step executing shell commands like this:

rm -rf /var/www/www.example.com/* 
find . \( -not -path '*/.svn/*' \) -exec cp -rv {} /var/www/www.example.com \;

However every time files in those folders such as .../classes/.svn/props are still copied.

I checked the find command manual, and the command seems correctly formed. So why is it not working? Also what is the purpose of putting a semicolon at the end? I copied this from somewhere :-)

I spent a few hours on this and still cannot get it work, so painful. Maybe using rsync is a better choice.

Kevin
  • 567
  • 2
  • 8
  • 19
  • Have to tried the answer for this question: http://stackoverflow.com/questions/4210042/exclude-directory-from-find-command – Jugal Shah May 01 '13 at 06:36

1 Answers1

1

You are ignoring .svn directories in your find command, but after that you do a recursive copy of directories, so if a directory contains a .svn directory you will still copy it. (and also your command does perform a lot of duplicate copies)

There are lots of options for copying directories excluding svn files - in your case I'd start with removing the -r.

If the above does not work google 'copy files without svn directories' for lots of different options.

Simon Groenewolt
  • 10,607
  • 1
  • 36
  • 64
  • Well even I removed the -r, the .svn folders are still copied, maybe because they are hidden folders. -prune is not working either. I give this up instead use rsync which is a lot easier. Trying different combinations of find options is really time wasting and depressing, I was unwise to pick this solution in my case. But thanks to all who have replied! – Kevin May 01 '13 at 12:52