From: Kevin Ballard Date: 2006-08-03T01:56:12+09:00 Subject: Re: cp * except .svn directories Hi all, On Wed, Aug 02, 2006 at 08:50:05PM +0900, Mark Woodward wrote: > Hi all, > > On Mon, 31 Jul 2006 23:58:52 +1000, Mark Woodward wrote: > > > Hi all, > > > > sorry if this is a repost! Don't know if it's Pan or my ISP but there's > > some weirdness going on ATM! > > > > What I'd like to be able to do is write a script that can copy all > > files/directories from a subversion repository except .svn directories. > > > > This is the best I can come up with from the command line (be gentle ;-)): > > > > 1. cd to repos dir > > 1. tar --exclude=".svn" -cvf foo.tar * > > 2. mv foo.tar /path/to/new > > 2. cd /path/to/new > > 3. tar -xvf foo.tar > > > > It works but I'm hoping there's a way to do this in a ruby script. If possible > > I'd like to be able to input "/path/to/new". > > > > So if I'm in the repos dir: > > > > cp_wo_svn.rb > > "to where?": /var/www > > "done!" > > > > > > thanks, > > thanks to all for the suggestions. Paul, yep I settled on Julians solution > though they all work! > > repos2local.rb > exec "rsync -arvz $HOME/svnwd/Proj1/www/ /var/www/ --exclude=\".svn\"" > > This copies the 'www' folder from the repos over to /var/www (ignoring > the .svn folders) but I'd now like to extend this. ie. > > repos2local.rb > exec "rsync -arvz $HOME/svnwd/Proj1/www/ /var/www/ --exclude=\".svn\"" > exec "rsync -arvz $HOME/svnwd/Proj1/includes/ /var/includes/ > --exclude=\".svn\"" > > ie chain together commands. > > This only does the first exec and I'm wondering is this a 'thread' issue > or similar? > > Any ideas how I handle this? It's because #exec replaces the current process with the new one. You need to fork and exec in the child (and in the parent, wait until the child is done before continuing). BTW, you might want to look into `svn export`, see if that's usable. The entire point of that command is to create a copy of the tree without any of the svn metadata (i.e. no .svn folders). -- Kevin Ballard http://kevin.sb.org kevin@sb.org