FileUtils
In addition to the functionality in File, Ruby has an entire module called FileUtils that defines many module level methods that are basically wrappers around operating system features or Dir and File features.
To use these methods, you need to use require "fileutils". All the methods here are defined as module methods and as instance methods, though you would typically use them as module methods, as in FileUtils.mkdir.
Methods in FileUtils that take paths expect either a string, an object with a to_path method, or an object with a to_str method. Methods in FileUtils that are described as working recursively can take directories as arguments and act on all files in the directory.
Let’s take a quick tour of the FileUtils.
Common Arguments ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access