From: "trans (Thomas Sawyer)" Date: 2012-07-29T22:32:36+09:00 Subject: [ruby-core:46857] [ruby-trunk - Feature #6811] File, Dir and FileUtils should have bang-versions of singleton methods that fails silently 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/