FileUtils Install

I am trying to build a script that deletes all folders within a specific
folder, and the only tool Ive found (by googling) is FileUtils.

I use Windows, and am trying to build this Ruby script to run on Windows

When I try and install FileUtils, it errors and says it needs RMagick,
which when I try and install that, I get an error saying it needs
ImageMagick, which when I try and install that, says it doesn’t exist
and to use mini_magick (which I have). All the posts on the internet say
to install various things, but all still error saying it needs something

Is there:
A) Another way to remove all folders within a given directory
(regardless if they are empty or not, or
B) Another way to install the gems required.

I did a gem update, and its updated a few gems (but it couldn’t update
to the latest version of mini_magick as there is a character issue when


FileUtils is part of the standard library, no need to install gems. Just
require “fileutils” and use it.

Sadly, there is a (defunct) gem called exactly “fileutils” which has
absolutely nothing to do with the Ruby stdlib FileUtils. The author of
the old gem seems to have renamed their gem, but not removed it from

On Thu, Nov 14, 2013 at 9:21 AM, Graeme H. [email protected]

Thanks, that makes perfect sense!

Im trying to use FileUtils, ive already added:

require ‘fileutils’ at the top, but my code doesnt want to work:

FileUtils.rm_rf Dir.glob(“T:\…\Backup\*”)

Works for me (albeit not under Windows). What does not work? Any
errors you are seeing? (You do have permissions, do you?)

Kind regards


The 4 colons were showing a directory tree.

I managed to get it working in the end, It seems that the slashes need
to be forward slashes rather than back.

Im quite new to Ruby, so just learning its quirks!

Thanks for your replies though.

On Nov 14, 2013, at 2:21 AM, Graeme H. [email protected] wrote:

Posted via

You need to tell us what is happening, what you expect to happen, any
error messages reported, behaviour, etc.

Also, I have no idea what 4 periods does inside a Dir.glob on Windows,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs