Ruby file utilities

Ruby provides a suite of methods for managing files in the fileutils module.

See also: Temporary files.


Use to move or rename files. This works when moving from one partition to another (unlike File.rename).

require 'fileutils''/old/path', '/new/path')

Use FileUtils.mkdir_p to create a nested directory structure. (Compare with Dir.mkdir which only creates one directory at a time.)

require 'fileutils'