require 'find' require 'fileutils' Find.find('./') do |path| if File.basename(path) == '.svn' FileUtils.remove_dir(path, true) Find.prune end end
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Recursively remove .svn directories (ruby script) (See related posts)
Comments on this post
#!/bin/sh for FILE in `find . -type d -name .svn`; do echo $FILE rm -r $FILE done
find . -type d -name .svn | xargs rm -rf
</code?
find . -type d -name .svn -exec rm -rf {} \;
the "-exec rm -rf {} \;" block tells find to execute "rm -rf" for a match (it replaces {} with the filename), and the "\;" is necessary to let the -exec switch know where the command passing stops.
find . -type d -name .svn -exec rm {} \;
I got “.svn is a directory†errors.
I had to add the rf flags:
find . -type d -name .svn -exec rm -rf {} \;
That worked for me.
buy degree | fake degree | accredited degree
rm -rf */.svn
rm -rf */*/.svn
rm -rf */*/*/.svn
also works like a dog :)
maybe one should make an alias for the smart oneliner
university degrees online | CorllinsUniversity
You need to create an account or log in to post comments to this site.
Related Posts
» Bulk svn actions (usefull wi... in ruby rails svn subversion
» Make a subversion release in ruby svn subversion release trunk repo repository
» update a working copy and al... in ruby shell svn subversion
» Add missing empty directorie... in ruby rsync svn subversion
» Subscribe to a RSS feed of y... in apache php mysql find awk email lighttpd ruby rails ssh date perl regex shell textpattern svn osx mac css python google html bash subversion backup script sql javascript dom expressionengine java flash actionscript rubyonrails unix linux applescript cli c ajax image xml terminal file web sed list delphi administration directory
» Get Two Properties From Entity in apache php mysql find awk lighttpd ruby rails ssh date perl regex shell textpattern svn http osx mac css python google html bash subversion windows sql activerecord javascript expressionengine java actionscript rubyonrails unix linux applescript cli database c text ajax image string xml terminal file array web delphi administration convert
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails