Here is a slightly more efficient way of doing the same thing:
find ./ -name .svn -exec rm -rf {} \;
When you use -exec find will execute the command for every result returned via the find query into the argument {}
Another useful command is to only perform and operation on files that have not been added or modified. You can do this like so:
svn status | grep ? | awk ‘{print $2}’ | xargs rm -rf
This would remove any file that has been added to the repository.
Breaking it down
svn status will return results like this:
? foo
M build/projects/Community.iml
M build/build.properties
Piping it through grep ? will give you:
? foo
Awk can be used to print out the column we want that is what the print $2 part of the awk command is for.
foo
finally pass the results to xargs rm
Hope this is interesting.
cheers,
A.J.
7 Comments