Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How I might use the rsync --delete option, but make the delete command 'svn rm'?

I have a repo of some config files and such, but those configuration files are not a working copy. I always copy them locally to a svn repo directory, excluding .svn, and then check them in. I have changed a bunch of file names so I want to delete the old ones in the repo (svn mv would be a bit overcomplicated for this).

Edit: Oh, and if there is a svn option that will give me the same end result, that is good too.

share|improve this question
Why? You shouldn't bother with the contents of your subversion repository. You'll lose the history of renamed files and you'll probably destroy the repo's integrity. – innaM Jul 28 '09 at 5:58
When you delete a file, doesn't it only delete is for the revision and keep it for the history (previous revisions), or is that not how it works? I don't care about the diff between previous versions of these particular files. – Kyle Brandt Jul 28 '09 at 10:27
That's how subversion works. Is there any harm in keeping those files around? – innaM Jul 28 '09 at 12:16
up vote 3 down vote accepted

I've never done this, but the way I'd attack this is write a script that:

  1. Runs rsync with the '--delete' option
  2. Run svn status*
  3. Collect all file names that were missing (the lines starting with '!')
  4. Run svn rm* on that list of file names
  5. You can even then do an svn commit -m* with a comment saying the files were delete after an rsync at said date and time.

* - using ssh to run the command remotely, if necessary.

share|improve this answer

svn delete $( svn status | sed -e '/^!/!d' -e 's/^!//' )
svn add $( svn status | sed -e '/^?/!d' -e 's/^?//' )

I found this at

share|improve this answer

Your Answer


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.