A man will die, but not his ideas.

Sunday, May 17, 2009

Removing .svn files manually from a managed directory..

I made a copy of an Eclipse project I was working on because I wanted to experiment with some things and didn't want to affect the original code. However, that project was managed by SVN and consequently all of the subdirectories of resulting copy also had the .svn subdirectories in them. I wanted to quickly delete all these subdirectories manually from the command-line. Here is what I did.

Use find to locate all the subdirectories having the given name within the desired directory. For example, for locating subdirectories with the name .svn within the current directory, use the following:

find . -name .svn

Now we pipe the results to xargs and use the rm -r as the command of choice for xargs. xargs will execute the given command on all the results obtained from the find command.

find . -name .svn | xargs rm -r

Because Unix filenames can contain blanks and newlines, please read the man pages for xargs for information regarding using xargs with such files.

Labels: , , ,

Posted by A :: 7:48 AM :: 0 Comments:

Post / Read Comments


Creative Commons License
Unless otherwise expressly stated, all original material of whatever nature created by the blog's author and included in the "A man will die, but not his ideas." weblog and any related pages, including the weblog's archives, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

* Java and the Java Coffee Cup Logo are trademarks or registered trademarks of Sun Microsystems,Inc. in the U.S. and other countries.