You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Peter Michaux <pe...@gmail.com> on 2006/05/27 16:03:54 UTC

removing .svn files from local copy

Hi,

I have a local copy of a repository. The repository no longer exists
so I cannot do a simple svn export to get a clean copy. How can I
remove all the .svn files from my local copy without removing each one
by hand? I'm using OS X.

Thanks,
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Nico Kadel-Garcia <nk...@comcast.net>.
Peter Michaux wrote:
> Hi,
>
> I have a local copy of a repository. The repository no longer exists
> so I cannot do a simple svn export to get a clean copy. How can I
> remove all the .svn files from my local copy without removing each one
> by hand? I'm using OS X.
>
> Thanks,
> Peter

I'm not sure about OS X command line tools, but under Linux/BSD/UNIX/etc., 
this would work:

    find dirname -name .svn -exec rm -rf {} \;

There are also fun and games due to resource forks for OS X: you might want 
to look into that first. 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Bob Proulx <bo...@proulx.com>.
Matt Doran wrote:
> Bob Proulx wrote:
> >Well, actually, no, not quite.  Sure it is completely contained in
>
> You win!  ;)

:-)

To paraphrase an old adage, "Old age and treachery will always triumph
over youth and enthusiasm!"  But more seriously as long as we both had
fun and learned something then we both win and that is even better.

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Matt Doran <ma...@papercut.biz>.
Bob Proulx wrote:
> Matt Doran wrote:
>   
>> That works. But the 'find' way of doing this is cleaner.
>>     
>>>  find . -name .svn | xargs rm -rf
>>>
>>> I almost always use zero terminated strings with find and xargs.
>>>
>>>  find . -name .svn -print0 | xargs -r0 rm -rf
>>>       
>> Or an even more findy way to do it  ...
>>
>>    find . -name .svn -exec rm -rf {} \;
>>
>> ;)
>>     
>
> Well, actually, no, not quite.  Sure it is completely contained in
> find.  But doing it that way is slower and less efficient than find
> plus xargs.  It executes rm once for each file.  That is much less
> efficient than using find plus xargs to run find (probably only once)
> with as large of an argument list as possible.  The find and xargs
> programs are designed to work together and make a great pair.  That is
> a very fast and efficient combination.
>
> If you want to use only find but still be efficient and execute rm as
> few times as possible then you need to look at the spiffy new POSIX
> find "-exec {} +" syntax.  Here is the snippet from gnu find's manual.
>
>        -exec command {} +
>               This  variant  of the -exec option runs the specified command on
>               the selected files, but the command line is built  by  appending
>               each  selected file name at the end; the total number of invoca-
>               tions of the command will  be  much  less  than  the  number  of
>               matched  files.   The command line is built in much the same way
>               that xargs builds its command lines.  Only one instance of  ’{}’
>               is  allowed  within the command.  The command is executed in the
>               starting directory.
>
> So using this the command becomes:
>
>   find . -name .svn -exec rm -rf {} +
>
> This is a pretty new feature and not all GNU find installations will
> have this feature yet.  I still use find plus xargs most of the time.
>
> Bob
>
>
>   
You win!  ;)

Re: removing .svn files from local copy

Posted by Bob Proulx <bo...@proulx.com>.
Matt Doran wrote:
> That works. But the 'find' way of doing this is cleaner.
> >  find . -name .svn | xargs rm -rf
> >
> >I almost always use zero terminated strings with find and xargs.
> >
> >  find . -name .svn -print0 | xargs -r0 rm -rf
> 
> Or an even more findy way to do it  ...
> 
>    find . -name .svn -exec rm -rf {} \;
> 
> ;)

Well, actually, no, not quite.  Sure it is completely contained in
find.  But doing it that way is slower and less efficient than find
plus xargs.  It executes rm once for each file.  That is much less
efficient than using find plus xargs to run find (probably only once)
with as large of an argument list as possible.  The find and xargs
programs are designed to work together and make a great pair.  That is
a very fast and efficient combination.

If you want to use only find but still be efficient and execute rm as
few times as possible then you need to look at the spiffy new POSIX
find "-exec {} +" syntax.  Here is the snippet from gnu find's manual.

       -exec command {} +
              This  variant  of the -exec option runs the specified command on
              the selected files, but the command line is built  by  appending
              each  selected file name at the end; the total number of invoca-
              tions of the command will  be  much  less  than  the  number  of
              matched  files.   The command line is built in much the same way
              that xargs builds its command lines.  Only one instance of  ’{}’
              is  allowed  within the command.  The command is executed in the
              starting directory.

So using this the command becomes:

  find . -name .svn -exec rm -rf {} +

This is a pretty new feature and not all GNU find installations will
have this feature yet.  I still use find plus xargs most of the time.

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Matt Doran <ma...@papercut.biz>.
That works. But the 'find' way of doing this is cleaner.
>   find . -name .svn | xargs rm -rf
>
> I almost always use zero terminated strings with find and xargs.
>
>   find . -name .svn -print0 | xargs -r0 rm -rf
>
>
>   

Or an even more findy way to do it  ...

    find . -name .svn -exec rm -rf {} \;

;)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Bob Proulx <bo...@proulx.com>.
Noah Slater wrote:
> >resolved. I used svn export which does work from a local copy.
> 
> This would have worked also:
> 
> $ find . | grep -E '/.svn$' | xargs rm -rf

That works.  But the 'find' way of doing this is cleaner.

  find . -name .svn | xargs rm -rf

I almost always use zero terminated strings with find and xargs.

  find . -name .svn -print0 | xargs -r0 rm -rf

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: removing .svn files from local copy

Posted by Noah Slater <ns...@gmail.com>.
> resolved. I used svn export which does work from a local copy.

This would have worked also:

$ find . | grep -E '/.svn$' | xargs rm -rf

-- 
"Creativity can be a social contribution, but only in so
far as society is free to use the results." - R. Stallman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: removing .svn files from local copy

Posted by Peter Michaux <pe...@gmail.com>.
On 5/27/06, Peter Michaux <pe...@gmail.com> wrote:
> Hi,
>
> I have a local copy of a repository. The repository no longer exists
> so I cannot do a simple svn export to get a clean copy. How can I
> remove all the .svn files from my local copy without removing each one
> by hand? I'm using OS X.

resolved. I used svn export which does work from a local copy.

Thanks,
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: removing .svn files from local copy

Posted by Lieven Govaerts <lg...@mobsol.be>.
You can export from a local working copy as well, like this:

svn export /Users/lgo/wc /Users/lgo/exported 

regards,

Lieven.

> -----Original Message-----
> From: Peter Michaux [mailto:petermichaux@gmail.com] 
> Sent: zaterdag 27 mei 2006 18:04
> To: Subversion Users List
> Subject: removing .svn files from local copy
> 
> Hi,
> 
> I have a local copy of a repository. The repository no longer 
> exists so I cannot do a simple svn export to get a clean 
> copy. How can I remove all the .svn files from my local copy 
> without removing each one by hand? I'm using OS X.
> 
> Thanks,
> Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org