End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
FileUtils#rm
rm(list, force: nil, noop: nil, verbose: nil)
lib/fileutils.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/fileutils.rb, line 569
def rm(list, force: nil, noop: nil, verbose: nil)
list = fu_list(list)
fu_output_message "rm#{force ? ' -f' : ''} #{list.join ' '}" if verbose
return if noop
list.each do |path|
remove_file path, force
end
end
Remove file(s) specified in list. This method cannot remove directories. All StandardErrors are ignored when the :force option is set.
Example
FileUtils.rm %w( junk.txt dust.txt ) FileUtils.rm Dir.glob('*.so') FileUtils.rm 'NotExistFile', force: true # never raises exception