Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

FileUtils#mkpath

mkpath(list, mode: nil, noop: nil, verbose: nil)

Alias of #mkdir_p

Creates a directory and all its parent directories. For example,

Example
FileUtils.mkdir_p '/usr/local/lib/ruby'

causes to make following directories, if they do not exist.

  • /usr

  • /usr/local

  • /usr/local/lib

  • /usr/local/lib/ruby

You can pass several directories at a time in a list.

See also #mkdir_p .mkpath #move #mkdir also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1