Method: FileUtils2#rm
- Defined in:
- lib/fileutils2.rb
#rm(list, options = {}) ⇒ Object Also known as: remove
Options: force noop verbose
Remove file(s) specified in list. This method cannot remove directories. All StandardErrors are ignored when the :force option is set.
FileUtils.rm %w( junk.txt dust.txt )
FileUtils.rm Dir.glob('*.so')
FileUtils.rm 'NotExistFile', :force => true # never raises exception
642 643 644 645 646 647 648 649 650 651 |
# File 'lib/fileutils2.rb', line 642 def rm(list, = {}) , OPT_TABLE['rm'] list = fu_list(list) "rm#{[:force] ? ' -f' : ''} #{list.join ' '}" if [:verbose] return if [:noop] list.each do |path| remove_file path, [:force] end end |