Moves file(s) src to dest. If file and
dest exist on the different disk partition, the file is copied
then the original file is removed.
FileUtils.mv'badname.rb','goodname.rb'FileUtils.mv'stuff.rb','/notexist/lib/ruby',:force=>true# no errorFileUtils.mv%w(junk.txt dust.txt),'/home/aamine/.trash/'FileUtils.mvDir.glob('test*.rb'),'test',:noop=>true,:verbose=>true
# File lib/fileutils.rb, line 498
def mv(src, dest, options = {})
fu_check_options options, OPT_TABLE['mv']
fu_output_message "mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
return if options[:noop]
fu_each_src_dest(src, dest) do |s, d|
destent = Entry_.new(d, nil, true)
begin
if destent.exist?
if destent.directory?
raise Errno::EEXIST, dest
else
destent.remove_file if rename_cannot_overwrite_file?
end
end
begin
File.rename s, d
rescue Errno::EXDEV
copy_entry s, d, true
if options[:secure]
remove_entry_secure s, options[:force]
else
remove_entry s, options[:force]
end
end
rescue SystemCallError
raise unless options[:force]
end
end
end