Issue #6811 has been updated by trans (Thomas Sawyer).


At least for mkdir you can use mkdir_p, although it annoyingly warns about missing path if $VERBOSE=true (can we consider that a bug please?).

----------------------------------------
Feature #6811: File, Dir and FileUtils should have bang-versions of singleton methods that fails silently
https://bugs.ruby-lang.org/issues/6811#change-28533

Author: prijutme4ty (Ilya Vorontsov)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


I found that often write 
Dir.mkdir(folder) unless Dir.exist? folder
and similar code for rm, rm_rf and so on
We can simply make bang-versions like
def Dir.mkdir!(folder, permissions=0744)
  Dir.mkdir(folder, permissions) unless Dir.exist? folder
# or another alternative  Dir.mkdir(folder, permissions) rescue false
end


-- 
http://bugs.ruby-lang.org/