nobu.nokada wrote: wrote
....
> Gavin Sinclair wrote:
> >   require 'fileutils'
> >
> >   FileUtils.rm_rf(directory)               # trash a directory tree
>                                                      ^^^^^^^^^^^^^^^^

This doesn't work if the directory "directory" itself isn't readable.

Here is  an example I created with cygwin (if cygwin isn't handy use
the explorer permission window or Microsoft's own xcaclcs tool).

$mkdir directory; chmod -w directory

E:\Ruby\Scripts>ruby -r fileutils -e "FileUtils.rm_rf('directory')"
E:/Ruby/lib/ruby/1.8/fileutils.rb:583:in `rmdir': Permission denied -
directory (Errno::EACCES)
        from E:/Ruby/lib/ruby/1.8/fileutils.rb:583:in `remove_dir'
        from E:/Ruby/lib/ruby/1.8/fileutils.rb:534:in `rm_r'
        from E:/Ruby/lib/ruby/1.8/fileutils.rb:526:in `each'
        from E:/Ruby/lib/ruby/1.8/fileutils.rb:526:in `rm_r'
        from E:/Ruby/lib/ruby/1.8/fileutils.rb:550:in `rm_rf'
        from -e:1


/Christoph