Skip to content

Using rsync together with Subversion – Part II

Ok, I was wrong. --cvs-exclude does not work but adding ./* to the exclude file alone does not work either. I’ve realized this important fact after uploading several (thousand?) svn-metadatafiles (whatever the correct term would be). Argh.

Further exploration revealed … nothing. I ‚came up‘ with adding

.svn/*
.svn/
.svn

to all my exclude-files. Just to go for sure. It seems .svn/* does not catch all cases. So extending the list seems reasonable (at least with the current low-level knowledge). But…

How to get rid of those files?

As I said, I – accidentally – uploaded lots (thousands) of files. Lucky me I have a shell-account on my webserver. Being able to say I got a shell account. always was cool. Not being able to use it heavily – lacking admin-level knowledge of Linux – should not be mentioned when boasting, though… 😉

What I wanted to say: I had to do some further research on how to delete lots of files, comfortably. I found find and did something like find -name '.svn' > out. Nifty. But how to get this into rm? rm like rm -rf to Read Mail Realy Fast – but you propably know that one…

To make long stories short, find -name '.svn' | rm -r won’t work. Here is the solution I’ve finally used:

find www -name '.svn' | xargs rm -r

www is the name of my public html-directory (under which all these .svn got added). The command pipes the result from find (all the .svn-directories) into rm. The option -r convinces rm to recursively do its job (deleting files/directories). I found the pointer to that solution in /bin/rm: Argument list too long. Thanks.

{ 3 } Comments

  1. Steve | 2009/10/16 at 10:15 | Permalink

    For the curious, the correct „find“ command would look like this…
    % find . -name „.svn“ -type d -exec \rm -rf {} \;
    Translated, find all the directories with the name „.svn“ and then with each found directory run the rm command recursively to remove them.  The xargs version works fine too.
    I use tcsh as my shell, many people use bash and you may have to place a \ in front of each of the braces to get it to work properly.
     

  2. Marco | 2009/11/20 at 03:51 | Permalink

    It’s not so complicated…
    Correct syntax:
    rsync -rvv –filter=‘- .svn/‘ someone@yourhost:./remotedir localdest
    or
    rsync -rvv –filter=‘- .svn/‘ localdir someone@yourhost:./remotedest
     

  3. Steffen | 2009/11/20 at 09:19 | Permalink

    Thanks to both of you for providing your solutions!

{ 2 } Trackbacks

  1. […] sync to work with Subversion smoothly in Using rsync together with Subversion – Part I and Part II. I’ve found the solution.
    The –cvs-e […]

  2. […] DenkZEIT : Using rsync together with Subversion – Part II. Leave a comment | Trackback Feb 18th, 2010 | Posted in SVN Tags: « Import MySQL […]

Post a Comment

Your email is never published nor shared. Required fields are marked *