Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We're trying to update an installed software which we have under control by subversion. The update instructions for the software require replacing several directories that have .svn directories in them.

Since we cannot replace these directories outright, I've been trying to come up with a way to replace the contents of these directories (and recursively the contents of all subdirectories), but not the directories themselves. I think there has to be a solution using some combination of flags for cp, but I cannot figure out what that combination is.

I looked at using cp -aR directory/ existing_directory/, but I cannot use -a because timestamps are not to be trusted for updates. I have no problem replacing all the files. Additionally, I don't believe the trailing slash will be carried through subdirectories recursively.

I would be grateful if someone could steer me in the proper direction. Thanks!

share|improve this question

1 Answer 1

up vote 4 down vote accepted

This sounds messy. Subversion gets all upset when you delete .svn directories.

The way I would do it is to create a copy, remove all the .svn directories from the copy, run the upgrade on the copy and then use rsync to copy all those changes from the copy to the original.

The sequence should look something like this:

cp -R software/ software-copy/
cd software-copy/
find . -type d -name .svn -delete
./upgrade-script.sh
cd ..
rsync -avtl software-copy/ software/

You can add -n in to those rsync options if you want to do a dry run and see what would be copied over without actually doing it.

share|improve this answer
    
That sounds like a reasonable enough solution. Thanks! –  Christopher Armstrong Mar 12 '12 at 13:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.