I want to store a file as /a/b/c/d.txt, but I do not know if any of these directories exist and need to recursively create them if necessary. How can one do this in ruby?
Use mkdir_p to create directory recursively
path = "/tmp/a/b/c" FileUtils.mkdir_p(path) unless File.exists?(path)