I have been playing around w Dir and FileUtils, and I can delete the stuff
I want to get rid off , but then I get some empty folders
is there any way to remove ( recursively.. ) all empty folders ?

I found a piece of code dated 2007 ... is there anything new around ?

thanks for feedback

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/DSNP_KL1BxYJ.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Erwin at Nov 21, 2012 at 5:49 pm
    [SOLVED] found a better module extending FileUtils .. it works

    module MyExtensions
    module FileUtils
    # Gracefully delete dirs that are empty (or contain empty children).
    def rmdir_empty(*dirs)
    dirs.each do |dir|
    begin
    ndel = Dir.glob("#{dir}/**/", File::FNM_DOTMATCH).count do |d|
    begin; Dir.rmdir d; rescue SystemCallError; end
    end
    end while ndel > 0
    end
    end
    end

    module ::FileUtils
    extend FileUtils
    end
    end


    Le mercredi 21 novembre 2012 18:35:57 UTC+1, Erwin a écrit :
    I have been playing around w Dir and FileUtils, and I can delete the stuff
    I want to get rid off , but then I get some empty folders
    is there any way to remove ( recursively.. ) all empty folders ?

    I found a piece of code dated 2007 ... is there anything new around ?

    thanks for feedback
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/frIZqMforq0J.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 21, '12 at 5:36p
activeNov 21, '12 at 5:49p
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Erwin: 2 posts

People

Translate

site design / logo © 2022 Grokbase